Graphics Reference
In-Depth Information
Adding this kind of parallelism is more complicated than merely spawning
multiple threads. It is also hard to ignore when considering high-performance
visibility computations. At the time of this writing, vector instructions yield an
8x to 32 x peak performance boost over scalar or branch-divergent instructions
on the same processors. Fortunately, this kind of low-level visibility testing is
increasingly provided by libraries, so you may never have to implement such an
algorithm outside of an educational context. From a high level, one can look at
hardware rasterization as an extreme optimization of parallel ray visibility testing
for the particular application of primary rays under pinhole projection.
36.3 The Depth Buffer
A depth buffer [Cat74] is a 2D array parallel to the rendered image. It is also
known as a z-buffer, w-buffer, and depth map. In the simplest form, there is one
color sample per image pixel, and one scalar associated with each pixel represent-
ing some measure of the distance from the center of projection to the surface that
colored the pixel.
To reduce the aliasing arising from taking a single sample per pixel, renderers
frequently store many color and depth samples within a pixel. When resolving to
an image for display, the color values are filtered (e.g., by averaging them), and
the depth values are discarded. A variety of strategies for efficient rendering allow
more independent depth samples than color samples, separating “shading” (color)
from “coverage” (visibility). This section is limited to discussions of a single depth
sample per pixel. We address strategies for multiple samples in Section 36.9.
Notice that the use of the depth buffer assumes that a single surface determines
the value of each pixel. If the scene does not satisfy this assumption, then
aliasing artifacts (see Chapter 18) are likely in the resultant rendering. This
assumption often fails for distant complex objects, where many surfaces may
all project within the same pixel. It makes sense, in these cases, to use a level-
of-detail representation in which distant objects (or even collections of objects)
are represented more and more simply to ensure that the assumption is valid.
Chapter 25 discusses simplification techniques for meshes. Other approaches,
like carefully choosing a far clipping plane, or masking distant objects with
fog, can also help to address this problem.
Obviously, more than one surface contributes to pixels that contain the sil-
houette of an object, regardless of how large the object is in screen space.
This is a pity, because this is a location at which the human visual system
is extremely sensitive to artifacts—we are much less likely to notice aliasing
within the interior of a shape.
Figure 36.11 reproduces Dürer's etching of himself and an assistant manu-
ally rendering a musical instrument under perspective projection. We have seen
and referred to this classic etching before. In it, one man holds a pen at the loca-
tion where a string crosses the image plane to dot a canvas that corresponds to
our color buffer. The pulley on the wall is the center of projection and the string
corresponds to a ray of light. Now note the plumb bob on the other side of the pul-
ley. It maintains tension in the string. Dürer's primary interest was the 2D image
 
 
 
Search WWH ::




Custom Search