Sign in to follow this  

Math behind Light Adaption

This topic is 4076 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 currently have this for light adaption. AdaptedLum + (CurrentLum - AdaptedLum) * ( 1 - pow( 0.98f, FPS * ElapsedTime) ); Now I would like to use something based on half life ... actually a colleague suggested to use half-life like this: AdaptedLum + (CurrentLum - AdaptedLum) * ( 1 - exp(ElapsedTime / half-life) ); How do I calculate the half-life term here? What I found is: T1/2 = ln(2) / lambda lambda is the decay constant, a positive constant used to describe the rate of exponential decay. What would lamdba be in this case? What we want to achieve here is framerate independance. The old equation changed with framerate. Any help is appreciated, - Wolf ... I should probably add, this is not C++ code ... this is HLSL code ... [Edited by - wolf on October 20, 2006 9:54:15 PM]

Share this post


Link to post
Share on other sites
what I actually need is a framerate indpendent blending between the previous frame luminance and the current frame luminance ...

Share this post


Link to post
Share on other sites
Exponential decay is always in the form Ae-λt. Lambda is related to the half-life using the equation you presented, so you have to decide on a half-life first and then calculate lambda. Let t be ElapsedTime, and you get:

AdaptedLum + (CurrentLum - AdaptedLum) * (1 - exp(-lambda * ElapsedTime));

One common mistake is to confuse τ, which is the time constant, with the half-life. The two aren't the same! Tau is simply the inverse of lambda, while the half-life is really just a more intuitive way for us to deal with decay.

Share this post


Link to post
Share on other sites

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