Sign in to follow this  
Optln

Getting Average Luminance

Recommended Posts

Optln    126
Hello. I'm trying to learn HDR rendering currently. Most implementations on the net and DX SDK samples, calculates average luminance of the scene by downsampling the scene texture to 1x1 and use it on the shader. I just get the smallest mipmap of render target and dot product it with the luminance values on the Reinhard's paper. Is this aproach less accurate than downsampling? And is there a reason(performance, compatibility etc.) for not to use mipmaps for average luminance calculation?

Share this post


Link to post
Share on other sites
MJP    19786
Well the thing is that you don't really want "average luminance", but rather the log-average (geometric mean) of luminance. The latter is what's used in the Reinhard paper, because it's less susceptible to small outliers. You can still do that with automatic mipmap generation if you want, but first you have to calculate the log of each luminance value, then generate the mips, then take the exp() of the lowest mip level to get your final luminance value.

Most of the older implementations didn't use automatic mipmap generation because driver support for it wasn't universal back in the D3D9 days (it is now in D3D10 and up). You also might be able to do it quicker with repeated downscaling...you'd have to profile to find out for sure.

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