High Dynamic Range (HDR) imagery has gotten a great deal of attention lately, but the principle is straight forward. While most images have historically used integers in the range 0-255 as pixel values, HDR images store data in floating point (decimal) format. A typical image may span the range 0.0-1.0, but the interesting part comes in when we allow values to rise above 1.0. The bright filament of a light-bulb can be accurately represented as 9.5 where it previously would get clipped at the standard 255 (1.0) cutoff.

While HDR values above 1.0 are generally not viewable on a standard monitor, their presence is strongly felt during image processing or when a final image is printed to film.


Creating HDR images

To create an HDR image from the real world, you must use a series of exposures specially combined using the technique described at http://www.debevec.org/Research/HDR/.

To create an HDR image using a 3D program, you only need to light objects in your scene brightly so that their highlights reach values greater than 1.0 and then have a renderer capable of creating and saving out floating point pixels.

In this tutorial we will also show the related technique of using an HDR image as a light source for added realism.



Setting up the Maya scene

The great thing about using the version of Mental Ray bundled with Maya is that it is so well integrated with the program. In general, you will work in Maya just as you always have. Here we will highlight the settings required to render out HDR from Maya.

1. Choose Mental Ray as your renderer from the Render Globals window. The regular Maya renderer is strictly Low Dynamic Range, so forget it.

2. Set your file format to TIFF, also in render globals.

3. In the Mental Ray tab, Framebuffer Attributes, set Data Type to RGBA [Float] 4x32 Bit. Make sure Colorclip is set to Raw.


When rendering previews, you'll want to use gamma-correction. HDR images are rendered in linear floating point, so they will appear dark on your non-linear display. Setting the Framebuffer's gamma attribute to the inverse of your monitor's will make renders appear properly on your display. So if your monitor's gamma is 2.2, enter 0.4545 (1/2.2) in the framebuffer's gamma field.

Important: for the final render, you should switch the framebuffer gamma back to 1.0.


Image Based Lighting

Mental Ray makes this part easy (in Maya 6) by including an Image Based Lighting section right in the render globals window. Click the Create button and Maya will make a new mentalrayIbl node and an environment sphere visible in 3D views.

Pick a light probe image in the mentalrayIbl1 Attribute Editor. While Mental Ray may be able to deal with other floating point formats, you will probably have the best experience if you choose a Radiance (.hdr) file in Maya. Samples of these files can be downloaded at http://www.debevec.org/Probes/.

When using Image Based lighting, you will probably also want to experiment with Mental Ray's Final Gather and Global Illumination settings, although these will greatly increase render time.

Maya 6 Project File

Floating Point TIFF sample


Rendering

To render HDR images from Mental Ray, you must use Maya's batch render function. Previews in the Render View have been converted to LDR and should not be saved out.

Reminder: set your Framebuffer gamma back to 1.0 when rendering.



HDR Compositing in After Effects

After Effects can't read our floating point TIFFs with the format plug-in that's included with it, so you'll need to download and install SuperTIFF. Disabling the old Adobe plug-in is a good idea too.

To do HDR compositing in After Effects, install The Orphanage's eLin. The eLin manual discusses the benefits and techniques involved, so here we will just throw together a simple eLin comp. You must be running the AE Production Bundle to use eLin for its 16-bit color mode.

1. Import your rendered floating point TIFF image with SuperTIFF. You can also import the .hdr lightprobe image if you've installed the included Radiance plug-in.

2. Make a new comp with our CG render floating above the light probe.

3. Both of these formats import floating point images in Log space to preserve dynamic range in After Effects. Convert them to eLin space using log2eLin.

4. Create an eLin view LUT. This can be done in one click if you're running the eLin palette.

5. Comp away in a linear HDR environment and reap the benefits!