Nodal Tone Mapping

From LightWiki

Jump to: navigation, search

Some time ago, I came up with a simple tone mapping technique that I called "Local HDR Blending" which was basically based on the local operator method (you can find that tut here)

However that technique was only viable with images loaded within ImageEditor, and was very hard to keep detail, saturation and original hues in very bright areas. Later, I found a way to implement a kind of logaritmic tone mapping with a mix of FPGamma, HDRExposure and WaveFIlter. This method provided better behavior on very bright areas, but in detriment of overall saturation and contrast. Besides none of these methods have real-time preview.

But all those disadvantages vanish if we solve the tone mapping within the Image Filter Node Editor. This method is is a mix of the log tone mapping and the local operator method, and it make use of 3 of my favorite gamma correction nodes. This is a simple implementation but you can add some other functions from here:

Image:ToneMappingConfig.gif

This setup assumes you are working within a linear color space workflow. Understanding its operation principle can help us to know how to use it:

1. We get the output render (linear) and flatten the ratio between bright and dark areas by changing the gamma distribution with an exponent of 5.5556 to take everithing close to the middle point. I'm using Aurora's Gamma Correction node here and this node must be locked (so don't touch it!).

2. After this gamma correction, all high lights will need an exposure adjustment. To find the bright zones (or even better, to define which areas of the image we'll consider bright), we take the linear output render and gamma correct it (with Aurora's Gamma Correction node) according to our visual perception (this depends on your working color space gamma, but commonly an exponent of 2.2 or 1.8 will work- but not less). Also you may want to change this exponent to use it as a roll off tool by playing with higher values. This color output is converted to gray scale (color=>scalar) to be used in opacity channel of the mixer node. If your render doesn't have bright areas extremely high, you can set it up in Minimum mode, otherwise, do use Luma.

3. For diminishing the exposure of bright areas and for tuning the details in these areas we use the Michael Wolf's Simple Colour Corrector node. This node is very useful because we can adjust the brightness (exposure in this case) and gamma (the strength and range in bright areas) in the same panel and real-time (in ImageFilter Node Editor preview or Viper). I wouldn't recommend to change anything else at this stage.

4. Once this adjustments are made in the light intensities values flattened logarithmically, we linearize the result again with the inverse exponent (.225) - by using Aurora's Gamma Correction node - and gamma correct this output result again according to the gamma of our output medium (log/rec 709/sRGB) by using the SG_CCFilter. Both nodes must be locked (so don't touch them!).

5. Later come the final adjustments (you can use Michael Wolf's Simple Colour Corrector node or LW's Color Tool - just notice both offers slightly different results). At this point Brightness works as our white clip parameter and Contrast works as our black clip parameter. Saturation and Hue play as themselves :) At this point we might want to separate this output in its RGB channels and adjust gamma, hue, saturation and contrast levels for RGB channels independently with Michael Wolf's Simple Colour Corrector node or we can colorize the image with several other setups.

Here are some HDR images tonemapped with this method:

Image:Church.jpg

A comparison between the linear version, the gamma corrected version, the previus tonemapping method, and the new nodal method. Notice how we can get more details in bright areas by avoiding glare effects and keepping better color saturation and hues with the nodal tonemapping - this image has a ratio about 1:300000)

Image:Gallery.jpg Image:Landscape.jpg

Image:Tree.jpg


This nodal setup can be useful for preview purposes within LW; so don't save any image with the filter enabled if you gonna finish the image in a compossiting package. This nodal setup can be used together with the SG_CCTools.

If you want to play, modify or enhance this nodal network, you can get it here.


Gerardo Estrada April 2008




Due to what I've interpreted as a request for a simpler setup, I've adapted my log tone maping setup that I commented in the previous tutorial (which uses FPGamma, HDRExposure and WaveFilter) for the nodal environment as well, so you can take a look how it works and results we can get with it.

Basically, we only adjust brightness, saturation and gamma. It works in this way:

Image:LogToneMappingConfig.gif

1. We get the output render (linear) and flatten the ratio between bright and dark areas by changing the gamma distribution with an exponent of 5.5556 to take everything close to the middle point. I'm using Aurora's Gamma Correction node here and this node must be locked.

2. Since at this point we have lost all contrast, with Michael Wolf's Simple Colour Corrector we crank up saturation in about 200% and gamma to 2.2 (we commonly won't need to touch these parameters later). At this stage we only adjust exposure with brightness parameter.

3. Once this adjustments are made in the colors and light intensities values flattened logarithmically, we linearize the result again with the inverse exponent (.225) - and gamma correct this output result again according to the gamma of our output medium (log/rec 709/sRGB) - we can use the SG_CCFilter. Both nodes must be locked.

4. Later come the final adjustments (you can use Michael Wolf's Simple Colour Corrector node or LW's Color Tool - just notice both offers slightly different results). At this point don't adjust exposure, just contrast and gamma. Eventually, you might want to tune saturation as well.

Results comparisons:

Image:Churchcomparison.jpg

We can see in this image how the log+local tone mapping offers more netural hues, saturation and contrast than the log approach.


Image:Gallerycomparison.jpg

This is probably a better case for the log tone mapping method. We could match saturation, but the first nodal method provides more details in bright zones and better contrast.


Image:Treecomparison.jpg

The same thing here, it's hard to get rid off glares in bright zones with the second log tonemapping method. In situations so contrated like this one, we get also a bright border line between very bright zones and very dark zones.

The second method (log tonemapping) is simpler to set up and use for sure, and we can use it with not-so high levels contrast ratios (1:2000 - 1:8000), but with higher contrast ratios I'd recommend the first nodal method (log+local tone mapping).

Here is the nodal configuration (adjusted for the gallery HDR) if you want to give it a try.


Gerardo Estrada May 2008

Views
Personal tools