Sign in to follow this  

Gamma Correction Ramp

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

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