Nidhish Raj Mourya - Depth Buffer Method (Chapter 4)
Nidhish Raj Mourya - Depth Buffer Method (Chapter 4)
Session: 2020-21
B A
B A A B A
Selecting the exact set of polygons which are visible from a given view point. More Generally the
problem is when you render pair of Objects or N Objects then which pixel should be in front of
another pixel. Which pixel should be rendered and visible.
Visible Surface
Detection Methods
• For each pixel, examine all n objects to determine the one closest to the viewer.
• If there are p pixels in the image, complexity depends on n and p ( O(np) ).
• These are developed for raster devices.
• Image can be enlarged without losing accuracy.
• A change of display resolution requires re-calculation. Accuracy of the calculation is bounded by
the display resolution
Diagram
• The z-coordinates are usually normalized to the range [0, 1]. The 0 value for z-coordinate indicates
back clipping pane and 1 value for z-coordinates indicates front clipping pane.
Z’ = -(A) …….(Equ. 3)
C
1. Initially each pixel of the Z-buffer is set to the maximum depth value (the depth of the back clipping
plane).
2. The image buffer is set to the background colour.
3. Surfaces are rendered one at a time.
4. For the first surface, the depth value of each pixel is calculated.
5. If this depth value is smaller than the corresponding depth value in the Z-buffer (i.e. it is closer to
the view point), both the depth value in the Z-buffer and the colour value in the image buffer are
replaced by the depth value and the colour value of this surface calculated at the pixel position.
6. Repeat step 4 and 5 for the remaining surfaces.
7. After all the surfaces have been processed, each pixel of the image buffer represents the colour of a
visible surface at that pixel.
1 1 1
1 1 1 1 1
1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1
1
1 1 1 0.5
1 1 1 1 1 1 1 1 1