Sign in to follow this  

Inner workings of D3DSAMP_SRGBTEXTURE?

This topic is 4306 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've currently used pixel shader code to do gamma correct blending with the lighting etc. I'm now trying to switch over to using the sampler state D3DSAMP_SRGBTEXTURE instead. The documentation is a little bit vague on the subject. Currently I do something like this: InColor = TextureColor ^ (1 / TextureGamma) BlendedColor = InColor * LightIntensity OutPixel = BlendedColor ^ DisplayGamma Assuming that TextureGamma is 2.2 I'd assume that you can remove the InColor computation, and setting D3DSAMP_SRGBTEXTURE to one, so that you simply get: BlendedColor = TextureColor * LightIntensity OutPixel = BlendedColor ^ DisplayGamma However this doesn't yield the correct results, the image is now much too dark! Dosn't D3DSAMP_SRGBTEXTURE=1 perform something like: OutColor = TextureColor ^ (1 / 2.2) ?? BTW, I've checked so that my card supports the D3DSAMP_SRGBTEXTURE state and the output does change when I enable this feature.

Share this post


Link to post
Share on other sites

This topic is 4306 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this