O'Reilly logo

GPU PRO 3 by Wolfgang Engel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

1
IV
Efficient Online Visibility for
Shadow Maps
Oliver Mattausch, Jiri Bittner, Ari Silvennoinen,
Daniel Scherzer, and Michael Wimmer
1.1 Introduction
Standard online occlusion culling is able to vastly improve the rasterization per-
formance of walkthrough applications by identifying large parts of the scene as
invisible from the camera and rendering only the visible geometry. However, it
is of little use for the acceleration of shadow-map generation (i.e., rasterizing the
scene from the light view [Williams 78]), so that typically a high percentage of
the geometry will be visible when rendering shadow maps. For example, in out-
door scenes typical viewpoints are near the ground and therefore have significant
occlusion, while light viewpoints are higher up and see most of the geometry.
Our algorithm remedies this situation by quickly detecting and culling the
geometry that does not contribute to the shadow in the final image. Note that
from the geometry visible from the light, only a small fraction will remain (for
Figure 1.1. The shadow-map geometry rendered for a particular Left 4 Dead view
(left) and the corresponding light-view visualization (right), where the rendered shadow
casters are shown in red.
233
234 IV Shadows
example, the red parts in Figure 1.1). The main idea is to use camera-view visi-
bility information to create a mask of potential shadow receivers in the light view,
which restricts the areas where shadow casters have to be rendered. This algo-
rithm makes shadow-map rendering efficient by providing the important property
of output sensitivity (i.e., the complexity depends only on what is visible from
the camera and not the size of the scene).
The method is easy to integrate into an existing rendering engine that already
performs occlusion culling for rasterization. It is orthogonal to the particular
occlusion-culling algorithm being used. We used the CHC++ algorithm [Mat-
tausch et al. 08] in our implementation, but in principle any state-of-the-art
occlusion-culling algorithm can benefit from our method. Likewise, our method
does not pose any restriction on the shadow-mapping algorithm being used. It
was tested successfully with different algorithms like uniform shadows, LiSPSM,
or cascaded shadow maps.
Our method is particularly useful for shadow mapping in large-scale outdoor
scenes. In terms of overall render time (i.e., the whole pipeline until the final
shaded image is rendered), the algorithm achieves a speedup of up to ten in real-
world city scenes compared to the na¨ıve use of occlusion culling. It also brings a
significant speedup of up to two in real game scenes (e.g., a Left 4 Dead level as
shown in Figure 1.1).
1.2 Algorithm Overview
The algorithm consists of the following four main steps, as also shown in Fig-
ure 1.2. Steps 1 and 4 constitute the standard approach for deferred shading
(including shadow mapping); the main contributions of our algorithm are Steps 2
and 3.
Step 1: Determine shadow receivers. First we use occlusion culling to render the
scene from the camera. This gives us the visible geometry, which corre-
sponds to the potential shadow receiver geometry. Such an initial depth
pass is a common practice in rendering engines. Our implementation uses
a deferred shading approach, where other attributes like the geometry nor-
mals are stored in separate render targets for subsequent shading together
with the depth buffer. We use a bounding volume hierarchy over the geom-
etry as input to our occlusion-culling algorithm, and the potential shadow
receivers correspond to the leaves of this hierarchy. Note that this step
provides a conservative estimate of the visible geometry.
Step 2: Create a mask of shadow receivers. Next we render the potential re-
ceivers from the light view to generate a so-called receiver mask. During
shadow-map rendering, shadow map updates are restricted to this mask.
We can further tighten the receiver mask and restrict shadow-map render-
ing to only those shadow map texels that correspond to visible receiver

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required