Jump to content
  • Advertisement
Sign in to follow this  

Gamma Correction Ramp

This topic is 3751 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

Hello, I would like to implement a gamma correction "user setting" in my game engine and I would like to know I can do that ? I guess the easiest way to achieve that is to use "SetGammaRamp" and "GetGammaRamp" functions provided by DirectX SDK but how should I modify the ramps based on a single gamma correction factor (float value between 0.0 and 2.5 for example) given by the user ? I think the default gamma ramp values (at directX initialization) are given for a gamma factor of 1.0, right ? Then, what are the mathematical formula to modify all the ramp values when a new gamma factor must be applied ? Thank you in advance for your answer. Cheers Amarhys

Share this post


Link to post
Share on other sites
Advertisement
Usually you use the gamma value 'γ' (or rather its inverse) as the exponent in an equation like ax1/γ to set the gamma ramp. Since the D3DGAMMARAMP structure contains WORD arrays of 256 elements, the max value 'a' in that equation is 65536, and 'x' ranges between 0 and 1 in 256 increments. Then you just find a good range for the gamma value, like [0.25,1.75].

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!