Graphics Reference
In-Depth Information
Let Depth( p ) denotes the “depth” of a point p , that is, the z-coordinate of p in the
camera or eye coordinate system. The array DEPTH below holds these z-values of
object points nearest to the eye.
color array FRAMEBUF[XMIN..XMAX,YMIN..YMAX];
real array DEPTH[XMIN..XMAX,YMIN..YMAX];
begin
Initialize FRAMEBUF to the background color;
Initialize DEPTH to •;
for all faces F in the world do
for each point p of F do
if p projects to FRAMEBUF[i, j] for some i, j then
if Depth ( p ) < DEPTH[i, j] then
begin
FRAMEBUF [i, j] := color of F at p ;
DEPTH [i, j]
:= Depth ( p );
end
end ;
Algorithm 7.7.1.
The Z-buffer algorithm.
are variants of the Z-buffer algorithm that incorporate antialiasing. An early scan line
approach described in [Catm78] was computationally expensive. A more efficient
approach, called the A-buffer algorithm, is described briefly in Section 7.11.
A Z-buffer takes up a lot of memory. By taking a scan line approach, one only
needs an array as long as a scan line. This leads to a slightly modified Z-buffer
algorithm shown in Algorithm 7.7.2. See [Roge98]. Such Z-buffer algorithms all use
the notion of “segment” and “span” in a scan line (where a face intersects the scan
line) and ask the question “Which segments are visible?” One uses the x-z plane. The
dotted lines in Figure 7.8(a) divide the scan lines into “spans.” Within each span one
determines the visibility of segments by checking their depths using plane equations .
Different choices of spans are possible because the only criterion is that one can
unambiguously order the segments within it by their depths. Therefore, there is the
issue of how to best choose the spans? For example, Figure 7.8(b) shows a better
choice of spans than Figure 7.8(a).
The scan line algorithms all do
(1) a Y sort to limit attention of algorithm to edges or faces which intersect scan line
(2) an X sort
(3) Z depth search
With regard to (1), one brings in new edges, etc., as one proceeds to the next scan line
and discards those that are no longer needed. One uses coherence and a list of “active”
Search WWH ::




Custom Search