Jump to content
  • Advertisement
Sign in to follow this  
Quat

HDRToneMappingCS11 what operator?

This topic is 2256 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 have been working on an implementation of ToneMapping but I think there is a bug, as my output does not match the HDRToneMappingCS11 demo. Due to the adaptation, I am getting some color changes as I look around the scene, but my images look too dark. I am using the same constants as the HDRToneMappingCS11 demo and the same HDR cubemap for testing L"Light Probes\\uffizi_cross.dds".

static const float4 LUM_VECTOR = float4(.299, .587, .114, 0);
static const float MIDDLE_GRAY = 0.72f;
static const float LUM_WHITE = 1.5f;
static const float BRIGHT_THRESHOLD = 0.5f;

My ToneMapping operator is the one based on http://www.cs.utah.edu/~reinhard/cdrom/.

But when I look at the HDRTomeMappingCS11 code (for the pixel shader path), their tonemapping formula is different:

// Tone mapping
vColor.rgb *= MIDDLE_GRAY / (vLum.r + 0.001f);
vColor.rgb *= (1.0f + vColor/LUM_WHITE);
vColor.rgb /= (1.0f + vColor);

Also they don't seem to take the geometric average to the scene luminance, but just the arithmetic average--I can't find any log() or exp() calls.

Also, it looks like some implementations of Reinhard are converting from RGB to another color space, then converting back, but some implementations don't do this....so I am not sure.

Share this post


Link to post
Share on other sites
Advertisement
I fixed the bug in my code, which had to do with copying and pasting some of the HDRToneMappingCS11 code into my code without fixing up some variables.

Anyway, it looks like the HDRToneMappingCS11 demo modifies Equation 4 in http://www.cs.utah.edu/~reinhard/cdrom/ to use the pixel color rather than the pixel luminance value so that the color is remapped rather than the luminance value. This way we don't have to worry about converting from luminance back to RGB color space.

Finally, to get results exactly like the HDRToneMappingCS11, I modified my code to use the arithmetic average instead of the log average. I understand why the geometric average is used in the paper, but maybe it is not really necessary in real-time?

Share this post


Link to post
Share on other sites
With a geometric mean outliers have less of an effect on the result, which is pretty nice for auto-exposure. Otherwise if you some small really bright spots (such as emissive light sources) they will pull the average luminance up and your exposure may end up being too low. It also means that if you have small light sources that come on and off over time the exposure will change more drastically to try to compensate, which can look very bad.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!