Graphics Reference
In-Depth Information
Figure 9.10.
Using parity with shadow polygons.
parity algorithm to determine if a point on a surface is in a shadow. If an even number
of polygons with the same tag are encountered, then the point is not shadowed by
that light source, otherwise it is. Figure 9.10 shows how the parity works for spans
associated to a polygon P . In Figure 9.10(a) object P is not in the shadow of S because
there are two shadow polygons determined by A and B that lie between it and the
eye. In Figure 9.10(b) object Pis in the shadow of S because only a single shadow
polygon, the one containing A , lies between it and the eye. Although we have only a
single pass through the visibility algorithm when using shadow volumes, there are
more objects and they are more complex.
The shadow z-buffer approach to shadows first determines the visibility of objects
with respect to the light source and then uses this information in a second pass that
determines the visibility with respect to the viewer. This amounts to running the
visible surface determination algorithm twice. The approach has the advantage of
being easy to integrate into a standard z-buffer algorithm. One uses an extra buffer,
called the shadow z-buffer , for each light source. (One can get away with only one
buffer for multiple light sources by running the basic algorithm once for each light
source.) In the case of a single light source, here are the two steps in this algorithm:
Step 1.
One runs a z-buffer type algorithm from the point of view of the light source
to “render” the scene into the shadow z-buffer. In this pass only the depths
of points are recorded and no light computations are made.
Step 2.
One runs the standard z-buffer algorithm from the viewer, but with the fol-
lowing change: Before storing any light information into the frame buffer
for a visible point, the coordinates of that point are first transformed into
the light source coordinate system and its distance from the light is com-
pared with the value stored for that position in the shadow z-buffer. If its
value is larger than the stored value, then the point is in a shadow and the
frame buffer value is not updated.
Ray-tracing and radiosity methods will be described shortly and in the next
chapter. Computing shadows in the context of ray tracing is very easy. Basically, once
Search WWH ::




Custom Search