Game Development Reference
In-Depth Information
Chapter 10
Shadows
Shadows are an essential component of any rendered scene that attempts to de-
pict a realistic environment because they provide many visual cues about the lo-
cation of objects in 3D space. The methods used to generate shadows in real-time
applications fall into two broad categories. The first category is called shadow
mapping or shadow buffering , and it is an image-based algorithm that uses a
depth image generated from the location of a light source. The second category is
known as stencil shadows (due to its use of the stencil buffer), or sometimes
shadow volumes , and it is a geometric technique that derives volumes of space
for which light is blocked by shadow-casting objects. In this chapter, we provide
an introduction to both types of shadow rendering. There are several variations of
the shadow mapping technique (and this is still an active area of research) for
which we do not go into the details, but we do provide details for the shadow
volumes technique because it is more mature, and there is a generally accepted
best way to implement it.
10.1 Shadow Casting Set
In Chapter 8, we discussed methods for determining whether an object is visible
to the camera, and we presumed that we could ignore any object that didn't inter-
sect the view frustum when we rendered a scene. However, as soon as we intro-
duce a shadow-casting light source, the set of objects that can be directly seen by
the camera may no longer be the full set of objects that needs to be considered.
There could be objects outside the view frustum, and thus not directly visible,
that cast shadows into the view frustum onto other objects that are visible. Ignor-
ing these objects would cause visible shadows to appear and disappear as the
camera moves and objects enter or exit the view frustum.
The set of shadow-casting that we need to consider is clearly a superset of
the set of visible objects, and the position of the light source relative to the view
frustum determines which additional objects must participate in shadow genera-
279
Search Nedrilad ::




Custom Search