Nodal Tone Mapping


#1

Hello,

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:

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 HDRI tonemapped with this method:


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)


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.

Hope to see some nice tests with this nodal setup :slight_smile:

Gerardo


#2

To be honest Gerardo, i look like a monkey looking at all this, if you have the time, can you explain for the ‘‘non-graphics-scientists-that-like-to-model-and-make-nice-renders’’ what are the advantages of these new procedures? This looks like a very precise method but, in the end i will see the result in a 600 usd lcd, so will this be useful for me, or just for people working in high-end graphics like cinema etc?

Thanks and excuse my ignorance :slight_smile:


#3

abuminalis- I feel the same when it comes to nodes…still a layers guy here with a toe dipping into nodes :smiley: .

If you are asking will you see the difference on your LCD the answer is yes. it’s visible in the examples Gerardo has up.

Is tonemapping something you need/want?
That has more than one answer imo…below is 2 shot example of an HDR shoot we recently did. These 2 pics are single exposure, low dynamic range. For a dramatic look I would use this exposure…I love the blown out hilites that focus attention on the interior of the garage. In this case I wouldn’t want a tone mapped version since you would see the cars and stuff outside on the street, which would totally change the feel of the composition.

In another case you might want to see the details lost in the LDR blown out areas and also see more detail in the shadowy corners…then a tone mapped version would be desirable


Thanks for the tech info on Linear and HDR etc Gerardo…also the HDRI article. :thumbsup:


#4

Abuminalis, yes, its usage has a lot to do with the ‘look’ we are looking for as Softdistorsion has said. But I think it has a different incidence in renders than in photographs. People who don’t work below any linear workflow can be specially benefitted by a tone mapping operator since they can stay away very easily from very contrasted and dark renders by keeping intended colors and adjusting diffuse shading with some flexibility.

Tone mapping concept is really simple: As we know, real light intensities are very high and our eyes can adapt to a great portion of this range. In a room with low lighting values and an open window (middle day), you are able to see what is inside the room and outside the window without any problem (correct exposure for both). This capability to adapt our eyes according to the brightness levels for a great range of lighting conditions, is called local adaptation of the human vision. Most of the images devices only will be able to capture or display a portion of this real light range (some more than others). So these devices would show details of what is inside a room but what is outside the window will be totally bright:

or very dark inside the room and details outside the window:

In order to approximate the local adaptation capability that human vision has in a high dynamic range medium (real lighting values) within a medium with a limited dynamic range (common monitors), there are several tone mapping methods and tools (like those that come with Photomatix, ArtizenHDR, Picturenaut, Photoshop, FDR Tools, etc). So what we bassically do is to remap the high latitude in pixels brightness of an HDRI into an LDR medium just as our vision perceive it:


(image tone mapped with the nodal setup)

So yes, these tools and methods can be useful for anyone of us. Situation is that LW has very very few tools to make this within the package (the mix between HDRExposure or Expose and FPGamma are not always enough, and the ToneReproduction filter is already old - though is the only free LW filter made for this task, as far as I know). Some third-party renderers (like Kray and Fryrender) have really good tone mapping filters by offering to users much more control on how the final result will look like. Though this is not a replacement for good lighting and shading work, or proper implementation of linear workflows, it can be a good cheat in some cases, and a great plus in addition to a good lighting&surfacing work.

I encourage you to try it in your own renders and see when it can help you :slight_smile:

Softdistortion, Glad it helps, man. Thanks.

Gerardo


#5

Gerardo- Maybe you are the guy to ask about this…wondering if there is a way to do a setup for contrast blending that ignores the “a pixel is brighter if the object it represents received more light” rule and would allow a completely equallized/flat tonemap.


#6

Yes, it’s possible. The log tone maping setup that I commented in the tut above (which uses FPGamma, HDRExposure and WaveFilter) made precisely that; but as I said there, it provided less contrasted results and glare effects with images with very high contrast ratios.

I’ve implemented that method in nodal 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:

  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:


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


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.


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


#7

thanks Gerardo.


#8

Excellent info!


#9

Softdistortion, your are welcome, man :slight_smile:
Insider, thanks Dan!

Gerardo


#10

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.