hidden surface removal

10
CECS461 Computer Graphics II University of Missouri at Columbia Hidden Surface Removal

Upload: kirkan

Post on 05-Jan-2016

26 views

Category:

Documents


1 download

DESCRIPTION

Hidden Surface Removal. Hidden Surface Removal. Object-Space and Image-Space Approaches Back-Face Culling Z-Buffer Algorithm Depth Sort and Painter’s Algorithm. Algorithm Classifications. Object-Space Methods: Visibility is decided by comparing objects in object-space. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Hidden Surface Removal

CECS461 Computer Graphics II University of Missouri at Columbia

Hidden Surface Removal

Page 2: Hidden Surface Removal

CECS461 Computer Graphics II University of Missouri at Columbia

Hidden Surface Removal• Object-Space and Image-Space Approaches

• Back-Face Culling

• Z-Buffer Algorithm

• Depth Sort and Painter’s Algorithm

• Object-Space and Image-Space Approaches

• Back-Face Culling

• Z-Buffer Algorithm

• Depth Sort and Painter’s Algorithm

Page 3: Hidden Surface Removal

CECS461 Computer Graphics II University of Missouri at Columbia

Algorithm Classifications• Object-Space Methods:

– Visibility is decided by comparing objects in object-space.

– e.g. painter’s algorithm.

• Image-Space Methods:– Visibility is decided at each pixel position in the

projection plane.– e.g. Z-Buffer algorithm

• Object-Space Methods:– Visibility is decided by comparing objects in object-

space.– e.g. painter’s algorithm.

• Image-Space Methods:– Visibility is decided at each pixel position in the

projection plane.– e.g. Z-Buffer algorithm

Page 4: Hidden Surface Removal

CECS461 Computer Graphics II University of Missouri at Columbia

Back Face Culling

x

z

Page 5: Hidden Surface Removal

CECS461 Computer Graphics II University of Missouri at Columbia

Back Face Culling

x

z

• A polygon is a back face if V • N > 0.

• For OpenGL, V=(0,0,-1)

• A polygon is a back face if V • N > 0.

• For OpenGL, V=(0,0,-1)

Page 6: Hidden Surface Removal

CECS461 Computer Graphics II University of Missouri at Columbia

Z-Buffer Algorithm

x

(x, y)

z

y

• Most widely used Image-space algorithm.

• Easy to implement, both in software and hardware.

• Incremental computation.

• Most widely used Image-space algorithm.

• Easy to implement, both in software and hardware.

• Incremental computation.

Page 7: Hidden Surface Removal

CECS461 Computer Graphics II University of Missouri at Columbia

Z-Buffer Algorithm

x

(x, y)

z

y

Page 8: Hidden Surface Removal

CECS461 Computer Graphics II University of Missouri at Columbia

Z-Buffer Algorithm• Can be conducted with scan-conversion.

Assume the plane equation of the triangle is

ax + by + cz + d = 0

let (x1, y1, z1) and (x2, y2, z2) be two points on the triangle.

x = x2 - x1 , y = y2 - y1 , z = z2 - z1

then a x + b y + c z = 0

since x = 1, y = 0, then z = - a/c.

• Can be conducted with scan-conversion.

Assume the plane equation of the triangle is

ax + by + cz + d = 0

let (x1, y1, z1) and (x2, y2, z2) be two points on the triangle.

x = x2 - x1 , y = y2 - y1 , z = z2 - z1

then a x + b y + c z = 0

since x = 1, y = 0, then z = - a/c.

Page 9: Hidden Surface Removal

CECS461 Computer Graphics II University of Missouri at Columbia

Painter’s Algorithm• Back-to-front rendering: polygons are sorted by

z-coordinates in object space, and are rendered in back-to-front order.

• Back-to-front rendering: polygons are sorted by z-coordinates in object space, and are rendered in back-to-front order.

x

z

y

A

CB

Page 10: Hidden Surface Removal

CECS461 Computer Graphics II University of Missouri at Columbia

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

Octree.

• Overlapped triangles need to be spitted.

• Need to check for overlapping using BSP tree or Octree.

• Overlapped triangles need to be spitted.