Hidden Surface Removal CECS 461 Computer Graphics II

  • Slides: 10
Download presentation
Hidden Surface Removal CECS 461 Computer Graphics II University of Missouri at Columbia

Hidden Surface Removal CECS 461 Computer Graphics II University of Missouri at Columbia

Hidden Surface Removal • • Object-Space and Image-Space Approaches Back-Face Culling Z-Buffer Algorithm Depth

Hidden Surface Removal • • Object-Space and Image-Space Approaches Back-Face Culling Z-Buffer Algorithm Depth Sort and Painter’s Algorithm CECS 461 Computer Graphics II University of Missouri at Columbia

Algorithm Classifications • Object-Space Methods: – Visibility is decided by comparing objects in objectspace.

Algorithm Classifications • Object-Space Methods: – Visibility is decided by comparing objects in objectspace. – e. g. painter’s algorithm. • Image-Space Methods: – Visibility is decided at each pixel position in the projection plane. – e. g. Z-Buffer algorithm CECS 461 Computer Graphics II University of Missouri at Columbia

Back Face Culling x z CECS 461 Computer Graphics II University of Missouri at

Back Face Culling x z CECS 461 Computer Graphics II University of Missouri at Columbia

Back Face Culling • A polygon is a back face if V • N

Back Face Culling • A polygon is a back face if V • N > 0. • For Open. GL, V=(0, 0, -1) z CECS 461 Computer Graphics II University of Missouri at Columbia x

Z-Buffer Algorithm • Most widely used Image-space algorithm. • Easy to implement, both in

Z-Buffer Algorithm • Most widely used Image-space algorithm. • Easy to implement, both in software and y hardware. • Incremental computation. (x, y) x z CECS 461 Computer Graphics II University of Missouri at Columbia

Z-Buffer Algorithm y (x, y) x z CECS 461 Computer Graphics II University of

Z-Buffer Algorithm y (x, y) x z CECS 461 Computer Graphics II University of Missouri at Columbia

Z-Buffer Algorithm • Can be conducted with scan-conversion. Assume the plane equation of the

Z-Buffer Algorithm • Can be conducted with scan-conversion. Assume the plane equation of the triangle is ax + by + cz + d = 0 let (x 1, y 1, z 1) and (x 2, y 2, z 2) be two points on the triangle. x = x 2 - x 1 , y = y 2 - y 1 , z = z 2 - z 1 then a x + b y + c z = 0 since x = 1, y = 0, then z = - a/c. CECS 461 Computer Graphics II University of Missouri at Columbia

Painter’s Algorithm • Back-to-front rendering: polygons are sorted by z -coordinates in object space,

Painter’s Algorithm • Back-to-front rendering: polygons are sorted by z -coordinates in object space, and are rendered in back-to-front order. y C B A x z CECS 461 Computer Graphics II University of Missouri at Columbia

Painter’s Algorithm • Need to check for overlapping using BSP tree or Octree. •

Painter’s Algorithm • Need to check for overlapping using BSP tree or Octree. • Overlapped triangles need to be spitted. CECS 461 Computer Graphics II University of Missouri at Columbia