Professional Documents
Culture Documents
Computer Graphics
ITGD3107
Chapter 13
Visible-Surface Detection
Visible-Surface Detection
Most visible-surface algorithms use imagespace methods Sometimes, these methods are referred to as hidden-surface elimination
4
Approaches
Back-Face Removal Depth Buffer A-Buffer Scanline Depth Sorting BSP Tree Area Subdivision Octree
Does not completely solve hidden surface problem since one polyhedron may obscure another
Ax By Cz D 0
Determine back-face
In projection coordinates, we need to consider only the z component of the normal vector N
Vview N 0
7
Depth-Buffer (Z-Buffer)
Z-Buffer has memory corresponding to each pixel location
Usually, 16 to 20 bits/location.
Depth-Buffer (Z-Buffer)
Initialize
Each z-buffer location Max z value
Each frame buffer location background color
z buffer(x,y) z(x,y)
pixel(x,y) color of polygon at (x,y)
9
Depth Calculation
Calculate the z-value on the plane
Ax By D Ax By Cz D 0 z C
Incremental calculation
z( x , y ) : the depth of position ( x, y )
z( x 1, y ) z( x , y 1)
A( x 1) By D A z( x , y ) C C Ax B( y 1) D B z( x , y ) C C
10
Depth-Buffer (Z-Buffer)
Advantages/Disadvantages
Lots of memory Linear performance Polygons may be processed in any order Modifications needed to implement antialiasing, transparency, translucency effects Commonly implemented in hardware very fast
11
Depth-Buffer (Z-Buffer)
Backface culling
Z-buffer algorithm
12
Even more memory intensive Widely used for high quality rendering
13
14
Maintain an active polygon and active edge list Can implement antialiasing as part of the algorithm
15
Depth Sorting
We need a partial ordering (not a total ordering) of polygons
The ordering indicates which polygon obscures which polygon Some polygons may not obscure each other
Simple cases
16
Depth Sorting
We make the following tests for each polygon that has a depth overlap with S If any one of these tests is true, no reordering is necessary for S and the polygon being tested
Polygon S is completely behind the overlapping surface relative to the viewing position The overlapping polygon is completely in front of S relative to the viewing position The boundary-edge projections of the two polygons onto the view plane do not overlap
17
Depth Sorting
Example
18
Depth Sorting
Cyclically overlapping surfaces that alternately obscure one another We can divide the surfaces to eliminate the cyclic overlaps
19
BSP Trees
Binary space partitioning is an efficient method for determining object visibility Paint surfaces into the frame buffer from back to front Particularly useful when the view reference point changes, but the objects are at fixed positions
20
2.
3. 4. 5.
Choose a polygon T and compute the equation of the plane it defines Test all the vertices of all the other polygons to determine if they are in front of, behind, or in the same plane as T. If the plane intersects a polygon, divide the polygon at the plane Polygons are placed into a binary search three with T as the root Call the procedure recursively on the left and right subtree
21
Area Subdivision
Image-space method taking advantage of area coherence in a scene Recursively subdivide a square area into equalsized quadrants if the area is too complex to analyze easily
22
Area Subdivision
Four possible relationships between polygon surfaces and a rectangular section of the viewing plane
Terminating criteria
Case 1: An area has no inside, overlapping, or surrounding surfaces (all surfaces are ourside the area) Case 2: An area has only one inside, overlapping or surrounding surfaces Case 3: An area has one surrounding surface that obscures all other surfaces within the area boundaries
23
Octrees
Visible-surface identification is accomplished by searching octree nodes in a front-to-back order
24