

Back
Next
Viewing & Rendering
Depth Comparison using
a z-Buffer
Advantages
- Faster method of VSD than clipping each polygon against every other polygon.
- Polygons do not have to be compared in any particular order: no presorting in z is necessary.
The z-buffer algorithm
- The z-buffer is initialized to the background value (furthest plane of view volume (= -1)).
- As each object is traversed, the z-values of its vertices are compared to the z-value in the same (x, y) location in the z-buffer.
- z can be determined by plugging x and y into the plane equation for the polygon (ax + by + cz + d = 0)
- If the new point has z values greater than the previous one (i.e., closer to the projection plane), its z-value is placed in the z-buffer; otherwise the previous z-value remains in the buffer.
- In 8 bit (1 byte) z-buffer, set 0.0 -> 255 and -1.0 -> 0


Back
Next
Viewing & Rendering - 09 MAY 95
Page 19 of 31
sl@cs.brown.edu
Generated with CERN WebMaker