5
HSR & Z-Buffer

HSR & Z-Buffer

Embed Size (px)

DESCRIPTION

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 - PowerPoint PPT Presentation

Citation preview

Page 1: HSR & Z-Buffer

HSR & Z-Buffer

Page 2: HSR & Z-Buffer

Fall 2009 revised 2

HSR (Hidden Surface Removal)

• Painters algorithm– Depth-sorting; Back-to-front rendering– Sort based on some points on the polygon

Page 3: HSR & Z-Buffer

Painter’s algorithm (cont)

• Cannot resolve this:– No correct ordering to draw these polygons

Page 4: HSR & Z-Buffer

Fall 2009 revised 4

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.

Page 5: HSR & Z-Buffer

Fall 2009 revised 5

Z-BufferNote: OpenGL has 0 at the near end and 1 at the far end

near

far