Using HDR Image In RAT

June, 2003

template:zjibi.slim

test scene: ibitest.mb

Introduction

A High-Dynamic Range image is an image that stores the amount of light in the world as floating-point numbers ranging from zero to one million and beyond. Usually the HDR images are created from chrome sphere placed in the live-action sets and used as the representation of the surrounding environment. This is a guide of how to use HDR images to render the effects like environment reflection and image-based environment illumination.

Format Convertion

Here we use the classic uffiz_probe.hdr downloaded form www.debevec.org. Load it into HDRShop, transform from angular map to latitude/longitude map.

Load the transformed .hdr file into any appearence having the line of "Environment Map".

Use the following expression:

[txmake C:/uffizi_latlong.hdr -envlatl -float]

to convert it to PRMan's texture file format. Render swatch, then object file uffizi_latlong.hdr.bb.tex will appear in the /rmantex directory under the current project path. Now you can simply load the .tex file and there is no need to convert it.

As Environment Maps

A typical use of the HDR images is environment maps.

normal Nf = normalize (faceforward (N, I));
vector R = normalize (reflect (I, N));
color Crefl = color environment (envmapname, R);

It is very sufficient to simulate environment reflections on non-flat surfaces. I write "zjChrome" to render this effect. Just attach it to the teapot, and no more light is needed.

Since we are using an HDR image, we can use "Exposure" to adjust the brightness of it without losing too much details.

env*= pow(2,exposure);

Optionally, people can use a ray-traced occlusion map to make the reflection more interesting.

Change "Refraction Index" to get more complex fresnel reflection.

Faking highlights.

If you use a "Kd" other than 0, the shader will respond to common light setting, but I prefer to use it as tool to render reflection passes.

Beyond Ambient Occlusion

In the earlier tutorials, ambient occlusion passes appeared as grey-scale values. People needed an additional "bent normal" pass to do the environment maps look-ups. I think "ibiD" will ease your life. It is a non-raytrace image-based illumination shader works with dome lights.

The shader of "ibiD" differs from "amboccD" by looking up environment maps to find out colors for each light.

It renders the diffuse light from a matte object.

A larger "Kl" will cause a more dynamic lighting. Note that some areas are still bright enough even when "Kd" is very low.

The IBI solution is very easy to setup and matchs lighting from the environment more accurately. You can quickly put your CG objects into another totally different environment by simply change the envirnment maps.

Compose Them Together

Finally, screen the reflection pass over the diffuse pass, and I use a contact shadow pass as the background.

More renders using different environment maps.