You are on page 1of 35

3D Hidden Surface Removal

2001.2.28

Contents
Goal Motivation Approaches - back face detection
- depth buffer - A-buffer - Scan line - Depth sorting - BSP-tree - Area subdivision - Ray casting

Conclusion

Goal
A major consideration is identifying those parts of a scene that are visible from a chosen view position. Represent realistic 3D display Visual-surface detection methods hidden-surface elimination methods

Motivation (1/4)
Surfaces may be various of situations according to view positions. - surfaces may be back-facing

Motivation (2/4)
Surface may be occluding

Motivation (3/4)
Surfaces may be overlapping

Motivation (4/4)
Surfaces may be intersecting

Approaches
Back-face detection Depth buffer A-buffer Scan line Depth sorting BSP-tree Area subdivision Ray casting
8

Classification
Objectspace methods - Viewer object , - wire frame display line display Image-space methods - using most methods - projection plane pixel position point visibility

Back-face detection (1/2)


Fast & simple object-space method Be based on Inside-outside test - decide on the back face

P(x,y,z) on the polygon Ax + By + Cz + D < 0


VN>0 back face

inside back face

V : Viewing direction vector(eye,camera) N : Normal vector to a polygon surface

10

Back-face detection (2/2)


V Vz projection coordinates convert
V = (0,0,Vz)
V Vy Vx Vz

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

11

Depth-Buffer Method (1/3)


Image-space method Compare surface depths at each pixel position on the projection plane. Z-buffer method
Vy Vx
S3
S2 S1

Vz

12

Depth-Buffer Method (2/3)


Step - initialize the depth & refresh buffer depth(x,y) = 0, refresh(x,y) = Ibackground - compare depth values to previously 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)
13

Depth-Buffer Method (3/3)


Comments - requires lots of memory a system with resolution 1024 by 1024 = 1024 x 1024 x 24bits - subject to aliasing(A-buffer) - commonly implemented in hardware

14

A-Buffer Method (1/3)


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
15

A-Buffer Method (2/3)


A-Buffer has two fields - depth field : store +,- real number - intensity field Using Linked list
d>0 I d<0 Depth Intensity Depth Intensity field field field field Surf 1 Surf 2

- d > 0 : single surface overlap - d < 0 : multiple surface overlap


16

A-Buffer Method (3/3)

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
background opaque surface foreground transparent surface
17

Scan-Line Method (1/2)


Image-space method Extension of the scan line algorithm Using Edge tables, polygon tables Set up an active list of edges cross 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
18

Scan-Line Method (2/2)


C G S1 A S2 B F

Scan line 1
Scan line 2 Scan line 3

Scan line 1 : no depth calculations Scan line 2 : depth calculations Scan line 3 : no depth calculations - take advantage of coherence

19

Depth Sorting Method (1/7)


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, starting with the surface of greatest depth Depth overlap - need to additional reordering process20

Depth Sorting Method (2/7)

21

Depth Sorting Method (3/7)


Overlap test 1.Bounding rectangles in the xy plane for the two surfaces do not overlap. 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 4.The projections of the two surfaces onto the view plane do not overlap one of these test is true no reordering 22

Depth Sorting Method (4/7)


1. bounding rectangles in the xy plane for the two surfaces do not overlap
S S

Xmin Vz

Xmax Xmin

Xmax

Vx

23

Depth Sorting Method (5/7)


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
S
S Vx Vz Test2,3 are true S

S
Vx

Vz

Test2 is not true

24

Depth Sorting Method (6/7)


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

25

Depth Sorting Method (7/7)


When 4 tests failed, interchange surfaces in the sorted list
S S

S
Vx Vz In sorted list S,S S,S

S Vx

Vz In sorted list S,S,S S,S,S


26

BSP-Tree Method (1/2)


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

27

BSP-Tree Method (2/2)


P2

back

front

front P 1 back D front

P1 front P2 back P2

front back
C B

back
D

Painting order DBCA


28

Area-Subdivision Method (1/4)


Image-space method - object-space method : depth ordering Start with total view determine whether subdivision or not subdivision until a single surface or the size of a single pixel Similar to quad tree

29

Area-Subdivision Method (2/4)


surface Boundary area

Surrounding surface

Overlapping surface

inside surface

outside surface

If one of conditions is true, no subdivision 1. All surfaces are outside 2. Only one surface intersects in the area 3. One surface occludes other surfaces within area
30

Area-Subdivision Method (3/4)


All surfaces are outside - check the bounding rectangles of all surfaces against the area boundaries Only one surface intersects in the area - bounding rectangles can be used as initial check - no intersection inside intersection need to additional check whether overlap,outside,surrounding
31

Area-Subdivision Method (4/4)


One surface occludes other surfaces within area the minimum depth of maximum depth of > all other surface surrounding surface within the area - using 4 vertices method
Zmax (surrounding surface) Vx

Vz

Area

32

Ray Casting Method (1/2)


Cast ray from viewpoint through each pixel to find front-most surface

33

Ray Casting Method (2/2)


Light-ray paths backward from the pixels through the scene More effective detection method - Curved surface, particularly spheres a variation on the depth buffer method Conceptually simple, but not generally used

34

Summary
Hidden Surface Removal Algorithm - Back-face detection - Depth buffer - A-buffer - Scan line - Depth sorting - BSP-tree - Area subdivision - Ray casting
35

You might also like