i
i
i
i
i
i
i
i
9.1. Shadows 357
Figure 9.23. On the left, a 2048 × 2048 shadow map rendering of a shadow. In the
middle, a 256 ×256 shadow silhouette map provides a considerably better shadow than
the 256 × 256 standard shadow map on the right. (Images courtesy of John Isidoro,
ATI Research, Inc.)
changes, the algorithm to warp the matrix can hit some discontinuity and
cause a noticeable shift in the orientation and size of the shadow map
texel grid [312]. A number of developers have noted a “nervous,” unstable
quality to the shadows produced during camera movement [355, 887].
These schemes work best when the light’s direction is perpendicular to
the view’s direction (e.g., overhead), as the perspective transform can then
best be shifted to put more samples closer to the eye. One lighting situation
where matrix warping techniques fail to help is when a light is in front of
the camera and is pointing back at it. This situation is known as dueling
frusta. What is needed are more shadow map samples nearer the eye, but
linear warping can only make the situation worse [1119]. This problem
is the major limitation of this class of techniques. Lloyd et al. [784, 785]
analyze the equivalences between PSM, TSM, and LiSPSM. This work
includes an excellent overview of the sampling and aliasing issues with
these approaches.
A number of approaches have been explored to help increase shadow
map sampling where it is needed. One concept is to attempt to represent
the shadow’s edge more accurately. To this end, Sen et al. [1149] introduce
the shadow silhouette map algorithm. The shadow map is augmented by
silhouette edge information stored as a series of points. In this way, the
silhouette itself can be reconstructed more precisely. The main limitation
is that only one silhouette point can be stored per shadow texel, so that
complex or overlapping silhouette edges cannot be captured. Isidoro [594]
discusses optimizing the point-in-triangle test used. An example is shown
in Figure 9.23.
In related work, Sz´ecsi [1233] uses geometry maps in a number of ways to
produce high-quality hard shadows. Chan and Durand [169] use a shadow
map to discover pixels in the image that are near shadow boundaries, then
i
i
i
i
i
i
i
i
358 9. Global Illumination
perform shadow volume computations on only these pixels, to find the
exact shadow. Scherzer et al. [1120] explore improving shadow edges of
fragments over time by tracking the history of past results.
Fernando et al. [337] first researched the idea of adaptive shadow maps,
a hierarchical caching scheme combining GPU and CPU, using quadtrees
of shadow maps. Giegl and Wimmer [395, 396, 397] explore GPU-only
schemes in the same spirit, using a hierarchical grid. Lefohn et al. [752]
introduce an improved quadtree scheme for modern GPUs that overcomes
a number of earlier limitations.
One class of hierarchical methods that has seen commercial use is cas-
caded shadow maps (CSM). This idea first made a noticeable impact when
John Carmack described it at his keynote at Quakecon 2004. Jonathan
Blow independently implemented such a system [122]. The idea is sim-
ple: Generate a fixed set of shadow maps at different resolutions, cover-
ing different areas of the scene. In Blow’s scheme, four shadow maps are
nested around the viewer. In this way, a high-resolution map is available
for nearby objects, with the resolution dropping for those objects far away.
Forsyth [354, 357] presents a related idea, generating different shadow maps
for different visible sets of objects. The problem of how to handle the tran-
sition for objects spanning the border of a shadow map is avoided in his
Figure 9.24. On the left, the three shadow maps are shown: animated objects, grid
section, and whole level. On the right, a resulting image. (Images from “Hellgate:
London” courtesy of Flagship Studios, Inc.)
i
i
i
i
i
i
i
i
9.1. Shadows 359
scheme, since each object has one and only one shadow map associated
with it.
Flagship Studios developed a system for Hellgate: London” that blends
these two ideas [296]. Three shadow maps are generated. One shadow map
adjusts to the view’s focus and frustum and includes just the animated
(and/or breakable) objects in the scene. The second map is associated
with a grid section of the level, selected by the view position. It covers
a much larger area and includes only static objects. Finally, a third map
covers the whole level’s static objects. See Figure 9.24.
To access these maps, the object being rendered is checked to see if it
fully fits inside the second, grid-based shadow map. If so, this map is used,
else the full level map is accessed. In this way, nearby objects will use the
map with a higher sampling rate. The first map, of the animated objects, is
also accessed, for all objects rendered. Whichever z-depth result retrieved
from the two maps is lower is the one used for shadow determination. One
advantage of this system is that by separating out the animated objects to
their own map, the grid shadow map is regenerated only when the viewer
moves to a new grid section. The level map is generated only once. Nearby
animated objects are usually the focus of attention, and by this scheme,
these will cast the highest quality shadows.
Lloyd et al. [784, 785] introduce a scheme called z-partitioning and show
how it can help with shadow sample distribution. Engel [312] and Zhang et
al. [1404] independently researched the same idea, which the latter group
calls parallel split shadow mapping.
4
The idea is to divide the view frus-
tum’s volume into a few pieces by slicing it parallel to the view direction.
See Figure 9.25. As depth increases, each successive volume should have
about two to three times the depth range of the previous volume [312, 1404].
For each volume, the light source makes a frustum that tightly bounds it
and then generates a shadow map. Lloyd et al. discuss how this method
can be combined with LiSPSM. By using texture atlases or arrays, the
different shadow maps can be treated as one large texture, thus minimiz-
ing texture cache access delays [312]. Zhang et al. [1405] give a thorough
explanation of how to implement this rendering algorithm efficiently. A
comparison of the quality improvement obtained is shown in Figure 9.26.
Valient [1289] also provides implementation details and presents a method
of avoiding shimmer artifacts as objects transition from one shadow map
to another. Deferred shading can be used with CSM, computing the effects
of all shadow maps and saving the results in a separate channel for later
evaluation [312, 887]. The “sunlight occlusion” buffer in Figure 7.48 on
page 280 is an example.
4
Tadamura et al. [1237] introduced the basic idea seven years earlier, but it did not
have an impact until these researchers explored its usefulness in 2006.
i
i
i
i
i
i
i
i
360 9. Global Illumination
view
frustum
light
Figure 9.25. On the left, the view frustum from the eye is split into four volumes. On the
right, bounding boxes are created for the volumes, which determine the volume rendered
by each of the four shadow maps for the directional light. (After Engel [312].)
Figure 9.26. On the left, the scene’s wide viewable area causes a single shadow map at
a 2048 × 2048 resolution to exhibit perspective aliasing. On the right, four 1024 × 1024
shadow maps placed along the view axis improve quality considerably [1405]. A zoom
of the front corner of the fence is shown in the inset red boxes. (Images courtesy of Fan
Zhang, The Chinese University of Hong Kong.)
i
i
i
i
i
i
i
i
9.1. Shadows 361
Overall, this type of algorithm is straightforward to implement, can
cover huge scene areas with reasonable results, is trivial to scale by changing
the number of slices, and is robust. The dueling frusta problem is addressed
by simply sampling closer to the eye, and there are no serious worst-case
problems. This method is used in a growing number of applications that
render large outdoor environments [887].
A limitation of shadow map methods using a single projection is that
the light is assumed to view the scene from somewhere outside of it, some-
thing like a spotlight. Positional lights inside a scene can be represented
by any structure that captures the parts of the scene needed. The usual
approach is to use a six-view cube, similar to cubic environment mapping.
These are called omnidirectional shadow maps. The main challenge for
omnidirectional maps is avoiding artifacts along the seams where two sep-
arate maps meet. King and Newhall [659] analyze the problems in depth
and provide solutions, and Gerasimov [390] provides some implementation
details. Forsyth [355, 357] presents a general multi-frustum partitioning
scheme for omnidirectional lights that also provides more shadow map res-
olution where needed.
Using omni shadows with dual paraboloid mapping creates fewer seams,
but normally does not work well, due to non-linear interpolation prob-
lems [1174], i.e., straight edges become curves. Osman et al. [976] attack
the problem by tessellating objects based on distance from the light.
Percentage-Closer Filtering
A simple extension of the shadow map technique can provide pseudo-soft
shadows. This extension can also help ameliorate resolution problems that
cause shadows to look blocky when a single light sample cell covers many
screen pixels. The solution is similar to texture magnification (see Sec-
tion 6.2.1). Instead of a single sample being taken off the shadow map,
the four nearest samples are retrieved. The technique does not interpolate
between the depths themselves, but rather the results of their comparisons
with the surface’s depth. That is, the surface’s depth is compared sep-
arately to the four texel depths, and the point is then determined to be
in light or shadow for each shadow map sample. These results are then
bilinearly interpolated to calculate how much the light actually contributes
to the surface location. This filtering results in an artificially soft shadow.
These penumbrae change, depending on the shadow map’s resolution, and
other factors. For example, a higher resolution makes for a narrower soften-
ing of the edges. Still, a little penumbra and smoothing, regardless of how
nonphysical it is, is better than none at all. Sampling four neighboring tex-
els is a common enough operation that support is built into NVIDIA [145]
and ATI [594] GPUs. All GPUs that implement Shader Model 4.0 support
shadow map sampling [123].
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset