Sign in to follow this  

Tonemapping questions

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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
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.

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