i
i
i
i
i
i
i
i
352 9. Global Illumination
Too much bias causes a problem called “Peter Panning,” in which the
object appears to be slightly above the underlying surface. One method
that helps ameliorate this effect is to make sure the light frustum’s near
plane is as far away from the light as possible, and that the far plane is as
close as possible. Doing so increases the effective precision of the Z-buffer.
Another method of avoiding self-shadowing problems is to render only
the backfaces to the shadow map. Called second-depth shadow map-
ping [1321], this scheme works well for many situations; by default, most
surfaces have no chance of shadowing themselves. Or, more precisely, the
surfaces that now self-shadow are those that face away from the light, so
it does not matter. The problem cases are when objects are two sided or
in contact with one another. If an object is a two-sided cutout, e.g., a
palm frond or fence, self-shadowing can occur because the backface and
the frontface are in the same location. Similarly, if no biasing is performed,
problems can occur near silhouette edges or thin objects, since in these
areas backfaces are close to frontfaces. Also, solid objects must be “water-
tight” (manifold and closed), else the object may not fully cast a shadow.
The other problem with second-depth testing is that light leaks can
occur where objects are in contact or interpenetrate. In such cases, the
occluding backface’s stored distance is in some places greater than the
sampled receiver’s. This problem is in some ways the opposite of self-
shadowing. Problems can also occur in concavities in a solid model. Care-
ful rendering (e.g., pushing double-sided objects a bit farther away from
the light when building the shadow map), composition (avoiding objects
touching as much as possible), modeling (actually building extra occluder
polygons inside the shadow object to avoid light leaks), and traditional
biasing techniques can give good results. This algorithm is often used in
game development, where content and interactions are under full control
of the creators.
Woo [1374] proposes a general method of avoiding many biasing and
light leak problems by creating an intermediate surface on the fly. Instead
of keeping just the closest depth value, the two closest values are tracked in
separate buffers. For solid objects that do not intersect in space, frontfaces
and backfaces can be rendered to generate the separate buffers. Using two
passes of depth peeling is a general way to generate these buffers [76, 324].
These two buffers are averaged into one, which is then used as the shadow
map. For a solid object, this technique usually creates a shadowing surface
that passes through the middle of the object. For example, a sphere would
create a circle passing through its center and facing the light. However, this
technique can also have problems, such as light leaks and self-shadowing
for thin objects and near silhouette edges. See Figure 9.18. In practice,
the problems seen at j and k are relatively rare and not that noticeable,
especially when using multiple shadow map samples per fragment. By