Light Mapping

Light mapping, also sometimes called texture baking, is a method for sampling an object before rendering and storing the results for later use. The most common application samples illumination for each point of a texture image wrapped around the object, and stores that illumination in the texture. Illumination is effectively frozen into the texture, which can later be mapped onto an object in the conventional way.

The advantage is that rendering can obtain illumination quickly from the frozen illumination, instead of computing it at rendering time. This is especially valuable for indirect illumination, which takes more time to compute than direct illumination. Such textures, called light maps, are also commonly used in games.

Creating light map textures is fundamentally different from regular textures because the texture is written to disk, instead of read from disk. mental ray uses a writable keyword in the scene file, and special light mapping functions in the shader interface to gain write access to the texture.

Light mapping in mental ray is very flexible, and implemented with lightmap shaders. Lightmap shaders are initially called once per object triangle vertex ("vertex mode"), and then once more for the entire objects ("output mode"). The standard lightmap shader in the base shader library uses the per-vertex calls to collect point and normal information, which is then projected onto the texture during the final call, which samples illumination for each pixel of the texture. Other shaders could sample the illumination per vertex and use the final call only for color interpolation; this may be useful for game development using hardware vertex coloring but would create a very low-fidelity light map.

Light mapping is enabled by attaching a lightmap shader to the material of the object to be lightmapped. mental ray always samples the entire object even if the material is applied to only some parts of its surface. If the shader requires it, the scene must provide an appropriate texture projection.

Copyright © 1986, 2013 NVIDIA Corporation