Rendering Mental Ray: Tone mapping

From TOI-Pedia


Mental Ray produces image data with a high dynamic range (HDR), especially when used with physical lighting. This means the range from dark to light is much larger than a classic rendered image (also referred to as LDR: Low dynamic range). The LDR is tailored to the maximum contrast a conventional computer screen can display, which is much lower than the human eye can handle.

Images in which Mental Ray produced high dynamic range (HDR) light levels, which are physically correct, are often interpreted as 'over exposed' (too bright). So in most cases the high dynamic range produced by Mental Ray needs to be converted to a 'classic' LDR range.

Tone Mapping is a technique to convert a HDR range to a LDR range. It is used to save HDR source data into conventional image types which can be displayed on normal computer screens.

Using Mental Ray Tone Mapping in Maya

Currently there are two options for Tone Mapping in Mental Ray for Maya:


Suitable for basic Tone Mapping. Refer to Using_mia_exposure_simple for details.


Allows more advanced Tone Mapping, but is also a little more complex to set up and use. The documentation is the Maya help is a good start: The Photographic Tone Mapper.

Theory of mia_exposure_simple

These settings are best explained using an example. The goal is to map HDR image data onto a LDR image format. Let's assume we have a HDR image which has a darkest value 0 and a brightest value of 10. A conventional LDR image range is 0 to 1, so all values above 1 will be clipped. Your image would look seriously overexposed when this is not corrected.

For every attribute, only that attribute has been changed in the series for that attribute; all other settings are the same for each of the three images. Please consider the relative values; the absolute values depend heavily on your scene and aren't that informative by themselves.

Example of a histogram of HDR image data

The histogram above shows the distribution of dark and bright pixels in an image. As you can see the pixels range from black (value 0 at the left) to super-white on the left: it's a HDR image. A normal image, which can only handle LDR (a value of 1 is white) will clip all pixels right from the value 1 to white, resulting in a strange, over-exposed image.


First, the pedestal is applied. A value of 1 in our example would change the range from 0 - 10 to 1 - 11; a pedestal of -1 would change it to -1 - 9. It offsets the complete spectrum of the image, affecting what is called the black-point of the image.

pedestal = -0.1
pedestal = 0
pedestal = 0.1
Effect of Pedestal on the histogram


The the range is multiplied by the gain value. A gain of .1 would make an original range of 0 - 10 into 0 - 1. You might think that you would be finished... But when you apply this linear correction, your image would look really dark and boring. Instead, it's better to use 0.2 for this example, resulting in a range of 0 - 2. But then we still have values above 1...

gain = 0.1
gain = 0.3
gain = 0.5
Effect of Gain on the histogram


Next, the range is checked against the knee value. All values above the knee value will be compressed in the next step. A value between 0.5 - 0.75 seems to be appropriate in most cases.

knee = 0.40 (gain=0.9;compression=3.0)
knee = 0.60 (gain=0.9;compression=3.0)
knee = 0.80 (gain=0.9;compression=3.0)
position of Knee in the histogram


All values above the knee value are compressed with a ratio set by compression. 0 would mean no compression; in our example a value of 3 would compress the range 0.5 - 2 (above a knee of 0.5). A value of 5 would give fairly strong compression.

compression = 0.0 (gain=1;knee=0.5)
compression = 2.5(gain=1;knee=0.5)
compression = 5.0(gain=1;knee=0.5)
Effect of Compression (in combination with Knee) on the histogram


Finally, you can apply gamma correction. Mental Ray produces true linear color data with physical lighting. The problem is that humans don't perceive color values which are numerically twice as big, as twice as bright. Here is where gamma correction comes in. Typical computer screens have a gamma of about 2.2, so a value of 2.2 is commonly used. Some think this is a bit too 'bright', and tend to lower the gamma to 1.8, which is more in the range of photographic film.

gamma = 1.8
gamma = 2.2
gamma = 2.6

Back to Maya

Back to Lighting and rendering

Back to Mental ray rendering

Personal tools