+ All Categories
Home > Documents > Visible-Surface Detection Jehee Lee Seoul National University.

Visible-Surface Detection Jehee Lee Seoul National University.

Date post: 02-Jan-2016
Category:
Upload: helena-potter
View: 221 times
Download: 1 times
Share this document with a friend
Popular Tags:
27
Visible-Surface Detection Jehee Lee Seoul National University
Transcript
Page 1: Visible-Surface Detection Jehee Lee Seoul National University.

Visible-Surface Detection

Jehee Lee

Seoul National University

Page 2: Visible-Surface Detection Jehee Lee Seoul National University.

Visible-Surface Detection Methods

• Determine what is visible within a scene from a chosen viewing position

• Two approaches– Object-space methods: Decide which object, as a

whole, is visible – Image-space methods: The visibility is decided point-

by-point

• Most visible-surface algorithms use image-space methods

• Sometimes, these methods are referred to as hidden-surface elimination

Page 3: Visible-Surface Detection Jehee Lee Seoul National University.

Approaches

• Back-Face Removal• Depth Buffer• A-Buffer• Scanline• Depth Sorting• BSP Tree• Area Subdivision• Octree• Raycasting

Page 4: Visible-Surface Detection Jehee Lee Seoul National University.

Back-Face Removal (Culling)

• Used to remove unseen polygons from convex, closed polyhedron

• Does not completely solve hidden surface problem since one polyhedron may obscure another

Page 5: Visible-Surface Detection Jehee Lee Seoul National University.

Back-Face Removal (Culling)

• Compute the equation of the plane for each polygon– A point (x,y,z) is behind a polygon surface if

• Determine back-face– In projection coordinates, we need to consider only the z

component of the normal vector N

0 DCzByAx

0NVview

Page 6: Visible-Surface Detection Jehee Lee Seoul National University.

Depth-Buffer (Z-Buffer)

• Z-Buffer has memory corresponding to each pixel location

– Usually, 16 to 20 bits/location.

Page 7: Visible-Surface Detection Jehee Lee Seoul National University.

Depth-Buffer (Z-Buffer)

• Initialize

– Each z-buffer location Max z value

– Each frame buffer location background color

• For each polygon:

– Compute z(x,y), polygon depth at the pixel (x,y)

– If z(x,y) < z-buffer value at pixel (x,y), then

• z buffer(x,y) z(x,y)

• pixel(x,y) color of polygon at (x,y)

Page 8: Visible-Surface Detection Jehee Lee Seoul National University.

Depth Calculation

• Calculate the z-value on the plane

• Incremental calculation

C

DByAxzDCzByAx

0

C

Bz

C

DyBAxz

C

Az

C

DByxAz

yxyx

yxyx

),()1,(

),(),1(

)1(

)1(

),(position ofdepth the: ),( yxz yx

Page 9: Visible-Surface Detection Jehee Lee Seoul National University.

Depth-Buffer (Z-Buffer)

• Advantages/Disadvantages– Lots of memory (not anymore)– Linear performance– Polygons may be processed in any order

• Modifications needed to implement antialiasing, transparency, translucency effects

– Commonly implemented in hardware very fast

Page 10: Visible-Surface Detection Jehee Lee Seoul National University.

Depth-Buffer (Z-Buffer)

Backface cullingZ-buffer algorithm

Page 11: Visible-Surface Detection Jehee Lee Seoul National University.

Accumulation Buffer (A-Buffer)

• An extension of the depth-buffer for dealing with anti-aliasing, area-averaging, transparency, and translucency

• The depth-buffer method identifies only one visible surface at each pixel position– Cannot accumulate color values for more than one

transparent and translucent surfaces

• Even more memory intensive• Widely used for high quality rendering

Page 12: Visible-Surface Detection Jehee Lee Seoul National University.

Accumulation Buffer (A-Buffer)

• Each position in the A-buffer has two fields– Depth field: Stores a depth value– Surface data field

• RGB intensity components• Opacity parameter (percent of transparency)• Depth• Percent of area coverage• Surface identifier

Page 13: Visible-Surface Detection Jehee Lee Seoul National University.

Scan Line Method

• Intersect each polygon with a particular scanline and solve hidden surface problem for just that scan line– Requires a depth buffer equal to only one scan line– Requires the entire scene data at the time of scan conversion

• Maintain an active polygon and active edge list• Can implement antialiasing as part of the algorithm

Page 14: Visible-Surface Detection Jehee Lee Seoul National University.

Depth Sorting

• Painter’s algorithm– Draw polygons as an oil painters might do

• Sort polygons by depth and draw them from back to front

• Depth sorting is NOT simple

Page 15: Visible-Surface Detection Jehee Lee Seoul National University.

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

Page 16: Visible-Surface Detection Jehee Lee Seoul National University.

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

Page 17: Visible-Surface Detection Jehee Lee Seoul National University.

Depth Sorting

• Example

Page 18: Visible-Surface Detection Jehee Lee Seoul National University.

Depth Sorting

• Cyclically overlapping surfaces that alternately obscure one another

• We can divide the surfaces to eliminate the cyclic overlaps

Page 19: Visible-Surface Detection Jehee Lee Seoul National University.

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

Page 20: Visible-Surface Detection Jehee Lee Seoul National University.

BSP Tree Construction

1. Choose a polygon T and compute the equation of the plane it defines

2. 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.

3. If the plane intersects a polygon, divide the polygon at the plane

4. Polygons are placed into a binary search three with T as the root

5. Call the procedure recursively on the left and right subtree

Page 21: Visible-Surface Detection Jehee Lee Seoul National University.

Traversing BSP Trees

EYE 1

+X -X

C

B

A

D

E1

+ZF2

E2F1

EYE 2

A

C

F1 D

E2 F2

B

E1

Page 22: Visible-Surface Detection Jehee Lee Seoul National University.

BSP Trees

• BST tree construction requires a number of polygons to be fractured

• It is possible for the number of triangles to increase exponentially but, in practice, it is found that the increase may be as small as two fold

• A heuristic to help minimize the number of fractures is to enter the polygons into the tree in order from largest to smallest

Page 23: Visible-Surface Detection Jehee Lee Seoul National University.

Area Subdivision

• Image-space method taking advantage of area coherence in a scene

• Recursively subdivide a square area into equal-sized quadrants if the area is too complex to analyze easily

Page 24: Visible-Surface Detection Jehee Lee Seoul National University.

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

Page 25: Visible-Surface Detection Jehee Lee Seoul National University.

Octrees

• Visible-surface identification is accomplished by searching octree nodes in a front-to-back order

Page 26: Visible-Surface Detection Jehee Lee Seoul National University.

Ray Casting

• We consider the line of sight from the a pixel position through the scene

• Useful for volume data• Ray casting is a special case of

ray tracing that we will study later

Page 27: Visible-Surface Detection Jehee Lee Seoul National University.

Ray Casting Examples


Recommended