Tonemapping questions

Started by
3 comments, last by fais 7 years, 3 months ago

I am implementing tonemapping mainly based on this excellent article: https://mynameismjp.wordpress.com/2010/04/30/a-closer-look-at-tone-mapping/ and got a couple of questions.

1. The first step involves getting the global average luminance value, by outputting the luminance value per pixel into a texture and then generating mipmaps. However why is log/exp functions used when storing/retreiving the luma values?

2. I render my skybox (just a cube texture) after all lights but before tonemapping. After applying tonemapping it is noticably darker. Maybe this is OK but it looks abit wierd. Do I need to apply another technique to "light up" my skybox?

Cheers

Advertisement

1. Log/exp are used in order to calculate geometric mean. Imagine a very dark scene with a single extremely bright pixel. Without log you would get a very high average luminance.

2. It looks like that your skybox simply isn't bright enough compared to the rest of the scene.

Regarding your skybox, you didn't provide details but remember that most are using HDR skyboxes now which are bright as hell. If you're using an LDR skybox, I would experiment with artificially expanding the DR (just scalar multiply and subtract) with noising to control banding.

SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.

Like Krzysztof explained, the log and exp are used as part of computing the geometric mean of the image brightness. The idea of using geometric mean comes from Reinhard's original paper,and it was proposed as a way to reduce the effect of outliers when computing the average intensity. This can help give better results in the "extremely bright pixel" scenario that Krzysztof mentioned. So it's not strictly necessary to do it that way: you could use a simple average or any technique you want for computing an automatic exposure value. But you may run into issues with outliers depending on how you decide to do it.

Just to expand on what MJP and and Krazy Nark (sorry man I can't spell your name) have stated about geometric mean, here is a (good?) example of what the results look like vs the arithmetic mean:

Arithmetic Mean - given n elements, sum up all elements and divide by n.
If our domain is {1,1,27} then the output of this function is (27+1+1)/3 = 9.6.

Geometric Mean - given n elements, multiply elements together and take the nth root. If our domain once again is {1,1,27} then the output of this function is pow( 27*1*1, 1/3 ) or 3.

As you can see, in this hyper simple example, which way the results lean. And like MJP and KN stated, the geometric Mean will not allow overly bright outlier pixels to dominate and overpower the calculations as the example shows.

This topic is closed to new replies.

Advertisement