Jump to content
  • Advertisement
Sign in to follow this  

Inner workings of D3DSAMP_SRGBTEXTURE?

This topic is 4614 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
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!