80 likes | 321 Views
HSR & Z-Buffer. HSR (Hidden Surface Removal). Painters algorithm Depth-sorting; Back-to-front rendering Sort based on some points on the polygon. Painter’s algorithm (cont). Cannot resolve this: No correct ordering to draw these polygons. HSR (cont). Z-buffer Algorithm
E N D
HSR (Hidden Surface Removal) • Painters algorithm • Depth-sorting; Back-to-front rendering • Sort based on some points on the polygon Fall 2009 revised
Painter’s algorithm (cont) • Cannot resolve this: • No correct ordering to draw these polygons
HSR (cont) • Z-buffer Algorithm • For each pixel, we keep track of the corresponding depth or distance. • This is called the z-buffer. • If a new object is drawn, only replace the pixels in the frame-buffer if the new pixel’s value is less than the pixel’s value in the z-buffer. Fall 2009 revised
Z-Buffer Note: OpenGL has 0 at the near end and 1 at the far end far near Fall 2009 revised