Rendering OpenEXR and hdr Images with mental ray
When you're rendering in Maya, numerous image formats are available. Common formats, such as JPEG, TIFF, and BMP, provide 8-bit color space. That is, the red, green, and blue channels each possesses 8 bits of storage, providing a total of 24 bits and potentially providing 16,777,216 different colors. Several of the formats, on the other hand, provide HDR accuracy and are available to the mental ray renderer.
HDR stands for High Dynamic Range. An HDR image stores 32 bits per channel and utilizes a floating point. A floating point takes a fractional number (known as the mantissa) and multiplies it by a power of 10 (known as the exponent). For example, a floating-point number may be expressed as 9.935e+9, where e+9 is the same as X109. In other words, 9.935 is multiplied by 109, or 1,000,000,000, to produce a value of 9,935,000,000. Hence, a floating point has the advantage of storing a huge value with a limited number of digits. If the exponent uses a negative sign, such as e-9, the decimal travels in the opposite direction and produces 0.000000009935 (e—9 is the same as x10-9). Because HDR images use floating points, there is no practical limit to the number of colors, or tonal steps, they can provide.
HDR images are used to store multiple exposures captured by a digital camera within a single file. As a result, the HDR file properly exposes all areas of the photographed scene regardless of the dynamic range that is present. Dynamic range represents the minimum to maximum luminous values present. For example, a brightly lit window in an otherwise dark room might create a dynamic range of 10,000:1, where the light outside the window is 10,000 times more intense than the light reflected from a dark corner.
In contrast, standard digital photographs use an LDR, or Low Dynamic Range, image format. A single exposure is captured and stored in its own file. Many cameras write the files as 8-bit TIFFs or JPEGs. An 8-bit LDR image can display a maximum dynamic range of 255:1 (the maximum number of separate tonal steps available to an 8-bit channel is 255). The average CRT monitor fares even worse, displaying dynamic ranges as low as 100:1.
Although HDR images are routinely used in digital photography, they are also useful for 3D texturing, lighting, and rendering. In terms of Maya image formats, you have the option to output .hdr and OpenEXR files. Aside from describing High Dynamic Range images, the letters HDR describe a specific image format that is based on RGBE Radiance files. To differentiate between HDR as a style of image and HDR as the specific image format, I will refer to the image format by its .hdr extension.
OpenEXR is an image format developed by Industrial Light and Magic that carries the .exr extension. OpenEXR is flexible enough to offer 16-bit and 32-bit variations plus carry an arbitrary number of additional attributes, channels, and render passes (camera color balance information, depth channels, specular passes, and so on). In Maya, OpenEXR is supported by a plug-in. To activate the plug-in, choose Window ^ Settings/Preferences ^
Plug-In Manager and check the Loaded check box beside OpenEXRLoader.mll. You can also read 32-bit floating-point TIFFs in Maya by activating the tiffFloatReader.mll plug-in.
To render an OpenEXR or .hdr image, open the Render Settings window, change Render Using to mental ray, and change Image Format to OpenEXR or HDR. To take advantage of the dynamic range, you must launch a batch render by switching to the Render menu set and choosing Render ^ Batch Render. The Render View window, by comparison, can only display an 8-bit LDR version of the render. For specific applications of OpenEXR and .hdr images, see the following sections.
Viewing HDR Images i
You can view HDR images with a program that explicitly supports the format. Even with such a program, a simplified version must be displayed.
For example, Photoshop CS2 supports OpenEXR, .hdr, and 32-bit floating-point TIFF formats. When an HDR image is opened, Photoshop displays a limited portion of the dynamic range (which I'll refer to as exposure range). Photoshop allows you to select different exposure ranges by providing 32-bit exposure and gamma controls. To apply these controls, choose View ^ 32-Bit Preview Options and adjust the Exposure and Gamma sliders. The Exposure slider selects different exposure ranges within the image. If a Maya-rendered OpenEXR or .hdr image is opened in Photoshop CS2, the Exposure slider works in the same fashion. In simple terms, the Exposure slider controls the brightness of the image. The Gamma slider, in essence, controls the contrast of the image. The Exposure and Gamma sliders are measured in stops. A stop is the adjustment of a camera aperture that either halves or doubles the amount of light reaching the film. For the sliders, each stop is twice as intense, or half as intense, as the stop beside it (for example, +2 is twice as intense as +1 and four times more intense than 0).
An OpenEXR image is adjusted with Photoshop's 32-Bit Preview Options window.
Once the Exposure and Gamma sliders are adjusted in Photoshop, you can save an LDR version by choosing Image ^ Mode ^ 8 Bits/Channel, clicking the OK button in the HDR Conversion window, and choosing File ^ Save As. A sample OpenEXR file is included as lamp.exr in the Chapter 9 images folder.
Several programs, such as Photomatix Pro (www.hdrsoft.com) and HDRShop (www .hdrshop.com) are specifically designed to create and manipulate HDR images. For example, when an OpenEXR or floating-point TIFF is opened in Photomatix Pro, a single exposure range is selected for display. So you can view different exposure ranges, a small HDR Viewer window is provided. Based on the contents of the viewer, the exposure range changes. The chosen range fits within a standard LDR range that can be displayed on a monitor.
- Photomatix Pro with an HDR image previewed by the HDR Viewer window
To export an 8-bit LDR version of an HDR image while using Photomatix Pro, you must tone map the image. Tone mapping is the process by which the dynamic range is rescaled to fit within the standard 8-bit LDR dynamic range. In general, there are two methods by which this is achieved: global operator and local operator. With the global operator process, a pixel value is rescaled according to the global characteristics of the image; this tends to produce a more natural result. With the local operator process, the location of the pixel in the image is noted and compared to its surrounding pixels; this generally exposes all areas of the image equally. In Photomatix Pro, you can access the global operator process by choosing HDR ^ Tone Mapping and switching Method to Tone Compressor. You can access the local operator process by choosing HDR ^ Tone Mapping and switching Method to Details Enhancer.
(Left) HDR image viewed without exposure adjustment. (Middle) Same image tone mapped using global operator process. (Right) Same image tone mapped using local operator process.
HDRShop also displays a single exposure range when an HDR image is opened. To change the exposure range a stop at a time, you can use the + and - keys. To export an LDR version, you can choose File ^ Save As and select an LDR format. The exposure that is displayed is captured by the LDR. In addition, HDRShop provides an optional tone mapping plug-in. You can also tone map in Photoshop CS2 by switching Method to Equalize Histogram (global operator) or Local Adaptation (local operator) in the HDR Conversion window.
Post a comment