sr-01-31

Upload: kannanviknesh

Post on 04-Jun-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/13/2019 SR-01-31

    1/35

    1

    3D Hidden Surface Removal

    2001.2.28

  • 8/13/2019 SR-01-31

    2/35

    2

    Contents

    Goal Motivation Approaches

    - back face detection- depth buffer- A-buffer- Scan line- Depth sorting

    - BSP-tree- Area subdivision- Ray casting

    Conclusion

  • 8/13/2019 SR-01-31

    3/35

    3

    Goal

    A major consideration isidentifying those parts of a scene thatare visible from a chosen view position.

    Represent realistic 3D display

    Visual-surface detection methods

    hidden-surface elimination methods

  • 8/13/2019 SR-01-31

    4/35

    4

    Surfaces may be various of situationsaccording to view positions.

    - surfaces may be back-facing

    Motivation (1/4)

  • 8/13/2019 SR-01-31

    5/35

    5

    Surface may be occluding

    Motivation (2/4)

  • 8/13/2019 SR-01-31

    6/35

    6

    Surfaces may be overlapping

    Motivation (3/4)

  • 8/13/2019 SR-01-31

    7/35

    7

    Surfaces may be intersecting

    Motivation (4/4)

  • 8/13/2019 SR-01-31

    8/35

    8

    Back-face detection Depth buffer

    A-buffer

    Scan line Depth sorting

    BSP-tree

    Area subdivision

    Ray casting

    Approaches

  • 8/13/2019 SR-01-31

    9/35

    9

    Objectspace methods- Viewerobject,

    - wire frame display

    line display

    Image-space methods- using most methods- projection planepixel positionpointvisibility

    Classification

  • 8/13/2019 SR-01-31

    10/35

    10

    Fast & simple object-space method Be based on Inside-outside test

    - decide on the back face

    P(x,y,z) on the polygonAx + By + Cz + D < 0 inside

    back face

    V N > 0 back faceV : Viewing direction vector(eye,camera)

    N : Normal vector to a polygon surface

    Back-face detection (1/2)

  • 8/13/2019 SR-01-31

    11/35

    11

    Back-face detection (2/2)

    VVzprojection coordinatesconvert

    V = (0,0,Vz)Vz

    Vx

    Vy

    V

    V N = VzC ( C : variable)C(+ or -)back face

    C 0 viewer

    VN

  • 8/13/2019 SR-01-31

    12/35

    12

    Image-space method Compare surface depths at each pixelposition on the projection plane.

    Z-buffer method

    Depth-Buffer Method (1/3)

    Vz

    Vx

    Vy

    S3S2 S1

  • 8/13/2019 SR-01-31

    13/35

    13

    Step

    - initialize the depth & refresh bufferdepth(x,y) = 0, refresh(x,y) = Ibackground

    - compare depth values topreviously stored values in depth buffer Calculate the depth z for each (x,y)

    position on the polygon if z > depth(x,y), then set

    depth(x,y) = z, refresh(x,y) = Isurf(x,y)

    Depth-Buffer Method (2/3)

  • 8/13/2019 SR-01-31

    14/35

    14

    Comments- requires lots of memorya system with resolution 1024 by 1024= 1024 x 1024 x 24bits

    - subject to aliasing(A-buffer)- commonly implemented in hardware

    Depth-Buffer Method (3/3)

  • 8/13/2019 SR-01-31

    15/35

    15

    Extension of the depth-buffer method Antialiased,

    Area-averaged,

    Accumulation-buffer method by Lucasfilm For implementation in the surface

    rendering system

    - REYES(Renders Everything You Ever Saw) Viewing for more than one surface

    Antialiasing

    A-Buffer Method (1/3)

  • 8/13/2019 SR-01-31

    16/35

    16

    A-Buffer has two fields- depth field : store +,- real number- intensity field

    Using Linked list

    - d > 0 : single surface overlap

    - d < 0 : multiple surface overlap

    A-Buffer Method (2/3)

    d > 0 I

    Depth

    field

    Intensity

    field

    d < 0 Surf1

    Depth

    field

    Intensity

    field

    Surf2

  • 8/13/2019 SR-01-31

    17/35

    17

    Included data in the linked list- RGB intensity components- Opacity parameter(present of transparency- Depth- Persent of area coverage- surface identifier- other surface-rendering parameters

    - pointer to next surface

    A-Buffer Method (3/3)

    background

    opaque surface

    foregroundtransparentsurface

  • 8/13/2019 SR-01-31

    18/35

    18

    Image-space method Extension of the scan line algorithm Using Edge tables, polygon tables

    Set up an active list of edgescross the current scan line Define a flag for each surface (on or off)

    - to indicate whether inside or outside Take advantage of Coherence along scan

    lines Commonly implemented in software

    Scan-Line Method (1/2)

  • 8/13/2019 SR-01-31

    19/35

    19

    Scan line 1 : no depth calculations

    Scan line 2 : depth calculations

    Scan line 3 : no depth calculations

    - take advantage of coherence

    Scan-Line Method (2/2)

    C

    A BED

    FGScan line 1

    Scan line 2

    Scan line 3

    S1 S2

  • 8/13/2019 SR-01-31

    20/35

    20

    Both image-space and object-space method- sorting operation : both- scan conversion : image-space method

    Painters algorithm : oil painting Sort surfaces in order of decreasing depth

    No depth overlap

    - Scan convert surfaces in order, startingwith the surface of greatest depth

    Depth overlap

    - need to additional reordering process

    Depth Sorting Method (1/7)

  • 8/13/2019 SR-01-31

    21/35

    21

    Depth Sorting Method (2/7)

  • 8/13/2019 SR-01-31

    22/35

  • 8/13/2019 SR-01-31

    23/35

  • 8/13/2019 SR-01-31

    24/35

    24

    2.Surface S is completely behind the overlap-ping surface relative to the view position

    3.Overlapping surface is completely in front

    of S relative to the view position

    Depth Sorting Method (5/7)

    Vz

    Vx

    S

    S

    Vz

    Vx

    S

    S

    Test2 is not trueTest2,3 are true

  • 8/13/2019 SR-01-31

    25/35

    25

    4.The projections of the two surfaces ontothe view plane do not overlap

    Depth Sorting Method (6/7)

  • 8/13/2019 SR-01-31

    26/35

    26

    When 4 tests failed,interchange surfaces in the sorted list

    Depth Sorting Method (7/7)

    Vz

    Vx

    S

    S

    In sorted listS,S S,S

    Vz

    Vx

    S

    S

    In sorted listS,S,S S,S,S

    S

  • 8/13/2019 SR-01-31

    27/35

    27

    A kind of Depth-sorting Method Be useful when the view reference point

    changes,but the objects are fixed position

    Painting in the order back to front Commonly implemented in hardware

    BSP-Tree Method (1/2)

  • 8/13/2019 SR-01-31

    28/35

    28

    BSP-Tree Method (2/2)

    A

    B

    C

    D

    P1

    P2

    frontfront

    back

    back P1

    front back

    P2 P2

    front back

    A C

    front back

    B D

    Painting orderDBC A

  • 8/13/2019 SR-01-31

    29/35

    29

    Image-space method- object-space method : depth ordering

    Start with total view determine whether subdivision or not subdivision until a single surface orthe size of a single pixel

    Similar to quad tree

    Area-Subdivision Method (1/4)

  • 8/13/2019 SR-01-31

    30/35

    30

    If one of conditions is true, no subdivision

    1. All surfaces are outside2. Only one surface intersects in the area3. One surface occludes other surfaces

    within area

    Area-Subdivision Method (2/4)

    Surroundingsurface

    Overlappingsurface

    insidesurface

    outsidesurface

    Boundary area

    surface

  • 8/13/2019 SR-01-31

    31/35

    31

    All surfaces are outside- check the bounding rectangles of allsurfaces against the area boundaries

    Only one surface intersects in the area- bounding rectangles can be usedas initial check

    - no intersection insideintersection need to additional checkwhether overlap,outside,surrounding

    Area-Subdivision Method (3/4)

  • 8/13/2019 SR-01-31

    32/35

    32

    One surface occludes other surfaceswithin area

    - using 4 vertices method

    the minimum depth ofall other surfacewithin the area

    Area-Subdivision Method (4/4)

    Vz

    VxArea

    Zmax(surrounding

    surface)

    maximum depth of

    surrounding surface

  • 8/13/2019 SR-01-31

    33/35

    33

    Cast ray from viewpoint through each pixelto find front-most surface

    Ray Casting Method (1/2)

  • 8/13/2019 SR-01-31

    34/35

    34

    Ray Casting Method (2/2)

    Light-ray paths backward from the pixelsthrough the scene

    More effective detection method

    - Curved surface, particularly spheres a variation on the depth buffer method

    Conceptually simple, but not generally used

  • 8/13/2019 SR-01-31

    35/35

    35

    Hidden Surface Removal Algorithm- Back-face detection- Depth buffer

    - A-buffer- Scan line- Depth sorting- BSP-tree

    - Area subdivision- Ray casting

    Summary