Game Development Reference
In-Depth Information
L
Figure 10.1. Any objects that could cast shadows into the view frustum must intersect the
convex hull enclosing the view frustum and the position L of the light source. The blue
lines represent the edges of the view frustum between planes that face toward the light
source and planes that face away from the light source.
tion. In the case that the light source is actually inside the view frustum, we do
not need to consider any more than the visible set of objects because shadows can
only be cast out of the view frustum. For the only other case, that the light source
lies outside the view frustum, we need to be able to identify objects that are posi-
tioned between the light source and the view frustum in such a way that shadows
could fall upon visible objects. This can be achieved by considering the convex
hull enclosing the view frustum and the light source, as shown in Figure 10.1.
For an object to cast any part of its shadow into the view frustum, it must inter-
sect this region of space.
We construct the convex hull enclosing the view frustum and the light source
by assembling a set of planes for which the intersection of all the positive half-
spaces represents the shadow-casting region. First, we test the light position
against the six planes of the view frustum (see Table 5.1) by taking the dot prod-
uct between the four-dimensional plane vector and the homogeneous light posi-
tion with a w coordinate of one. The planes for which this dot product is positive
form part of the boundary of the convex hull. Then, for each pair of adjacent
frustum planes, if one has a positive dot product and the other does not, then we
calculate a new plane defined by the edge between those two frustum planes and
the position of the light source, making sure that the plane's normal direction
faces inward.
Search Nedrilad ::




Custom Search