# Math behind Light Adaption

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

## 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 on other sites
what I actually need is a framerate indpendent blending between the previous frame luminance and the current frame luminance ...

##### 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 on other sites
Thanks a lot! This was great!

1. 1
2. 2
Rutin
21
3. 3
JoeJ
18
4. 4
5. 5

• 14
• 39
• 23
• 13
• 13
• ### Forum Statistics

• Total Topics
631717
• Total Posts
3001878
×