Sign in to follow this  
Bruno

hdr lightning

Recommended Posts

Hi., I'm in the process of adding hdr lightning to the engine, but before i do so, i wanted to understand something. One of the features of hdr that gathers lots of attention, is that it allows to simulate that our eyes adjust to the light intensities. So when we look into a dark area of the scene our eyes will adjust to the darkenss, if we then look at a light source the scene will appear bright and our eyes will adjust to the lighting. So, my question is, this is controled by the amount of exposure that goes into the shader, right ? This means, in the areas of the game where we want this to happen, we must have a trigger or something like that, that will increase or decrease the exposure level that goes into the shader. Or is there a way to get this exposure level automatically from the scene ? thanks, Bruno

Share this post


Link to post
Share on other sites
there's a way of getting the exposure directly from the scene. I think you sample the rendertarget down and get the average luminance and somehow use it to find you exposure but don't quote me on that.

regards,
m4gnus

Share this post


Link to post
Share on other sites
The light adaptation effect occurs when you vary the effective average luminance from the real average luminance (which is measured directly from the scene, and necessary for tone mapping). So say your real luminance is 10000, but your effective luminance is 2000. Your HDR code will be using the effective luminance for its calculations, and since it's much lower than the real luminance, it will think the scene is darker than it really is and brighten it. As the effective luminance moves closer to the real luminance, the scene becomes darker until both values are equal. The reverse effect happens if the effective luminance is higher than the average luminance. As the user moves around and the scene changes, the real luminance changes, so you just keep adjusting the effective luminance toward the real luminance. This equation is used in the DirectX SDK HDRLighting sample:

float fNewAdaptation = fAdaptedLum + (fCurrentLum - fAdaptedLum) * ( 1 - pow( 0.98f, 30 * g_fElapsedTime ) );

Where fCurrentLum is the real luminance, and fAdaptedLum is the effective luminance. This equation brings both values 2% closer together every frame, at a rate of 30 FPS.

Share this post


Link to post
Share on other sites

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