Visible Surface Detect

Embed Size (px)

Citation preview

  • 8/2/2019 Visible Surface Detect

    1/27

    Visible-Surface Detection

    Jehee Lee

    Seoul National University

  • 8/2/2019 Visible Surface Detect

    2/27

    Visible-Surface Detection Methods

    Determine what is visible within a scene from achosen viewing position

    Two approaches Object-spacemethods: Decide which object, as a

    whole, is visible Image-spacemethods: 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

  • 8/2/2019 Visible Surface Detect

    3/27

    Approaches

    Back-Face Removal Depth Buffer

    A-Buffer

    Scanline Depth Sorting

    BSP Tree

    Area Subdivision Octree

    Raycasting

  • 8/2/2019 Visible Surface Detect

    4/27

    Back-Face Removal (Culling)

    Used to remove unseen polygons from convex, closedpolyhedron

    Does not completely solve hidden surface problem sinceone polyhedron may obscure another

  • 8/2/2019 Visible Surface Detect

    5/27

    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 zcomponent of the normal vector N

    0 DCzByAx

    0NVview

  • 8/2/2019 Visible Surface Detect

    6/27

    Depth-Buffer (Z-Buffer)

    Z-Buffer has memory corresponding to each pixel location Usually, 16 to 20 bits/location.

  • 8/2/2019 Visible Surface Detect

    7/27

  • 8/2/2019 Visible Surface Detect

    8/27

  • 8/2/2019 Visible Surface Detect

    9/27

    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

  • 8/2/2019 Visible Surface Detect

    10/27

    Depth-Buffer (Z-Buffer)

    Backface culling Z-buffer algorithm

  • 8/2/2019 Visible Surface Detect

    11/27

    Accumulation Buffer (A-Buffer)

    An extension of the depth-buffer for dealing withanti-aliasing, area-averaging, transparency, andtranslucency

    The depth-buffer method identifies only onevisible surface at each pixel position

    Cannot accumulate color values for more than onetransparent and translucent surfaces

    Even more memory intensive Widely used for high quality rendering

  • 8/2/2019 Visible Surface Detect

    12/27

    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

  • 8/2/2019 Visible Surface Detect

    13/27

    Scan Line Method

    Intersect each polygon with a particular scanline andsolve 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

  • 8/2/2019 Visible Surface Detect

    14/27

    Depth Sorting

    Painters algorithm Draw polygons as an oil painters might do

    Sort polygons by depth and draw them fromback to front

    Depth sorting is NOT simple

  • 8/2/2019 Visible Surface Detect

    15/27

    Depth Sorting

    We need a partial ordering (not a total ordering)of polygons

    The ordering indicates which polygon obscures whichpolygon

    Some polygons may not obscure each other

    Simple cases

  • 8/2/2019 Visible Surface Detect

    16/27

    Depth Sorting

    We make the following tests for each polygon that has adepth overlap with S

    If any one of these tests is true, no reordering isnecessary for S and the polygon being tested

    Polygon S is completely behind the overlapping surface relativeto the viewing position

    The overlapping polygon is completely in front of S relative to theviewing position

    The boundary-edge projections of the two polygons onto the

    view plane do not overlap

  • 8/2/2019 Visible Surface Detect

    17/27

    Depth Sorting

    Example

  • 8/2/2019 Visible Surface Detect

    18/27

    Depth Sorting

    Cyclically overlapping surfaces that alternatelyobscure one another

    We can divide the surfaces to eliminate thecyclic overlaps

  • 8/2/2019 Visible Surface Detect

    19/27

    BSP Trees

    Binary space partitioning is an efficient methodfor determining object visibility

    Paint surfaces into the frame buffer from back tofront

    Particularly useful when the view reference point

    changes, but the objects are at fixed positions

  • 8/2/2019 Visible Surface Detect

    20/27

    BSP Tree Construction

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

    2. Test all the vertices of all the other polygons to determine if theyare 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 root5. Call the procedure recursively on the left and right subtree

  • 8/2/2019 Visible Surface Detect

    21/27

    Traversing BSP Trees

    EYE 1

    +X -X

    C

    B

    A

    D

    E1

    +ZF2

    E2F1

    EYE 2

    A

    C

    F1 D

    E2 F2

    B

    E1

  • 8/2/2019 Visible Surface Detect

    22/27

    BSP Trees

    BST tree construction requires a number ofpolygons to be fractured

    It is possible for the number of triangles toincrease exponentially but, in practice, it is foundthat the increase may be as small as two fold

    A heuristic to help minimize the number offractures is to enter the polygons into the tree inorder from largest to smallest

  • 8/2/2019 Visible Surface Detect

    23/27

    Area Subdivision

    Image-space method taking advantage of areacoherence in a scene

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

  • 8/2/2019 Visible Surface Detect

    24/27

    Area Subdivision

    Four possible relationships between polygon surfaces anda rectangular section of the viewing plane

    Terminating criteria

    Case 1: An area has no inside, overlapping, or surroundingsurfaces (all surfaces are ourside the area)

    Case 2: An area has only one inside, overlapping or surroundingsurfaces

    Case 3: An area has one surrounding surface that obscures allother surfaces within the area boundaries

  • 8/2/2019 Visible Surface Detect

    25/27

    Octrees

    Visible-surface identification is accomplished bysearching octree nodes in a front-to-back order

  • 8/2/2019 Visible Surface Detect

    26/27

    Ray Casting

    We consider the line of sight fromthe a pixel position through thescene

    Useful for volume data

    Ray casting is a special case ofray tracing that we will study later

  • 8/2/2019 Visible Surface Detect

    27/27

    Ray Casting Examples