Simple Tone Mapping (mia)

 
 
 

| Render Tree Usage

Category: Lens

Shader Family: Lens

Output: Color

Related mental ray shader: mia_exposure_simple

When rendering physical light levels, problems can occur with managing the HDRI output of the real physics vs. the limited dynamic range of computer monitor displays. One method to deal with this to create visually pleasing results is known as tone mapping.

The Simple Tone Mapping (mia_Simple_Tone_Mapping) shader is a simple tone mapper. It simply adds a knee compression to "squash" overbrights into a manageable range. This shader takes the high dynamic range color and performs these operations in this order:

  1. The Pedestal parameter value is added to the color.

  2. The color components are then multiplied by the Gain parameter value.

  3. The resulting colors are checked if they are above the Knee parameter value.

  4. If they are above this value, they are "squashed" by the Compression ratio value.

  5. Finally, Gamma correction is performed.

Tonemapping

Pedestal

Allows you to tweak the equivalent of the "black level". A positive value adds some light so even the darkest black becomes slightly gray. A negative value subtracts some light and lets you create more contrasting effects.

Gain

Controls the overall brightness. This is the main point where the high dynamic range values are converted to low dynamic range values. For example: if you know that the approximate range of color intensities goes between 0 and 10, the Gain value should be approximately 0.1 to get the larger color intensity range in the desired range of 0 to 1.

However, since the point of tone mapping is not to blindly scale the range down, simply setting it to 0.1 will most likely yield a dark and boring image. A more likely value is 0.15 or even 0.2, but a value of 0.2 maps the 0-to-10 range down to 0 to 2. To deal with what's above 1, you need to use Compression.

Knee

The point where the overbrights begin to get "squashed". Since this is applied after Gain, it should be in the range of 0 to 1. A useful range is 0.5 to 0.75.

Compression

Compresses the overbrights. If you set this to 0.75, any color (after having Pedestal added and multiplied by Gain) that comes out above 0.75 is compressed. A value of 5.0 is fairly strong compression; 0 is no compression.

Gamma

Corrects the resulting compressed color for the output device (such as the computer screen).

Use Preview

Makes the process of tweaking the tone mapper more interactive by allowing you to preview the results.

To tweak the tone mapping using a preview image, do the following:

  1. Disable the Simple Tone Mapping shader.

  2. Render the image to a file in an HDRI capable format (such as *.exr, *.hdr, etc.) and name it, for example, preview.exr.

  3. Add the preview image to the scene as an image clip and source. For more information, see Creating Sources and Clips [Data Management].

  4. Enable the Simple Tone Mapping shader again.

  5. In the render tree, get the preview image from the Clips menu and connect it to the shader's preview input port.

  6. Select the Use Preview checkbox.

  7. Disable any photon mapping or final gathering.

  8. Re-render. The rendering will be nearly instant, because no actual rendering occurs at all: the image is read from the preview file and is immediately tone mapped to screen.

  9. Tweak the parameters and render again until you are satisfied with the results.

  10. Re-enable any photons or final gathering.

  11. Turn off Use Preview.

  12. The tone mapping is tuned and ready for final output.

Render Tree Usage

This shader can be applied directly to the camera in the lens shader stack. See Applying Lens Shaders to Cameras [Cameras and Motion Blur].

You can also use this shader in conjunction with the shader Architectural.