thedigitalfeed.co.uk content
thedigitalfeed.co.uk/Graphics
Maya, mentalRay and HDR, Part 2
Posted on Saturday the 18th of February, 2006
www.thedigitalfeed.co.uk/graphics/2006/02/18/maya-mentalray-and-hdr-part-2
Creating an HDR Image
To create our own HDR images, we're going to need a new shader for our camera. The latlong_lens mental ray lens shader is what we're looking for.
Once you've installed the shader (install instructions are included in the .zip file), create a new camera (name it sensibly!) and, in the mentalRay tab in the Attribute Editor, change the Lens Shader to the latlong_shader. By default, this shader will create panoramic images. Because we want it to act as a spherical environment, we need to check 'Flip Horizontal' in the latlong_shader node.
Now that we've set up the camera, we need to make sure Maya will save the render as an HDR file. In the Render Globals window, set the Image Format to 'mentalRay HDR'. Also, set the Resolution to a ratio of 2:1 (e.g. 2048/1024 or 1024/512).

Render Globals: Output File
Finally, in the mentalRay Framebuffer attributes, set the Data Type to 'RGB (Float) 3x32 bit'

Render Globals: mentalRay Framebuffer
Building the Scene
Now, we're going to build a scene for the camera to render. We're going to have to fake the lighting here. Using lights won't work, since they are not geometry. So we need to build lights (e.g. rectangular planes, or spheres) and set their incandesence to an overly high value (this is how HDR works). Although you cannot see values on-screen higher than 1.0, if you have a look at some HDR images (using Maya's image viewer) you will see that there are some points with alpha channel values in the hundreds. This is what we'll use to set the HDR values.
When you assign a lambert shader to an object acting as a light, use the Incandescence Colour to introduce these high values. Perhaps between the 10-20 range for R, G and B.
You can either build the scene around your camera, or introduce the camera into a pre-built scene. But if you want to move the camera, try not to alter the rotation. It is advisable to keep a fairly simple scene; remember, this is used primarily for lighting, and a few environmental reflections. There shouldn't be too much detail.
The only thing left to note is that you'll need to batch render your image. The Render Preview cannot output .hdr images. Set a filename in the Render Globals window, and you're all set.
As always, play around and have fun!