Getting Average Luminance

Started by
0 comments, last by MJP 12 years, 11 months ago
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?
Advertisement
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.

This topic is closed to new replies.

Advertisement