Front and Back Surfaces

The words "front" and "back" will be mentioned many times in this chapter. These shaders use specially formatted lightmaps to simulate scattering. The lightmaps are generated in image space, i.e. from the camera's point of view, and they store the diffuse irradiance and z-depth of the front and back side of the object.

In this context, "front" is defined as the first surface from the camera's point of view (that is facing towards the camera) and "back" as the second surface from the cameras point of view (that is facing away from the camera).

One can say the front surface is everything seen in the final rendering, and the back surface, the next surface behind it, which, if lit, could potentially scatter light through the object, to illuminate the front surface. In a practical sense, this means that front surface scattering is scattering seen directly, and back surface scattering is any light going through the object.

This also means that these functions are direction dependent and only work when the final render viewing direction is near or similar to the camera viewing direction, and the view projection is standard perspective or orthogonal. Observe the following:

Unlike the physical implementation, these shaders do not require photons, global illumination, caustics or even ray tracing to be enabled.

If any "through" scattering is planned (i.e. light passing through the object from the back to the front) one must think volumetrically when creating the model. While avoiding holes is not a necessity, it is imperative to pay attention to extra interior surfaces, since these will block light. For example, a "T" shape built from ramming two stretched cubes together will look incorrect due to the extra interior surfaces. An object fully contained within another object will, however, appear as a true embedded opaque object and can be useful for things like bones inside fingers for the "hand over flashlight" effect. The contained object must be included in the lightmap to act as a light blocker - any other contained object is simply ignored. The easiest way to do this is to apply the same material to the contained object, since it will never actually be seen or shaded, just block light.

Copyright (©) 1986-2009 by mental images GmbH