# Tonemapping questions

This topic is 718 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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

##### Share on other sites

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.

Edited by Promit

##### Share on other sites

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.

##### Share on other sites
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.

1. 1
2. 2
Rutin
19
3. 3
khawk
19
4. 4
5. 5
A4L
11

• 9
• 12
• 16
• 26
• 10
• ### Forum Statistics

• Total Topics
633771
• Total Posts
3013762
×