Professional Documents
Culture Documents
DETECTION
The problem of Visibility – Occlusion.
Problem Definition:
Given a set of 3-D surfaces to be
projected onto a 2-D screen, obtain the
nearest surface corresponding to any point
on the screen.
• Back-face Detection
• Depth (Z) buffer method
• Scan-line method
• Depth-sorting method
• Area-subdivision method
• Octree methods
• A-buffer method
• BSP Trees
• Ray casting method
V
How to get normal vector (N) for a
3D surface, polygon ?
R Q
R=PXQ
P
-R
Brighter Darker
Side side
Take the order of vertices to be
counter-clockwise for the brighter side.
Comp If i n, j
n
Yj )(Zi Z j )
a
i 1 (Yi
n
b (Z i Z j )(Xi X j ) where j i
in
1
1
X j )(Yi Y j )
i
c (XIf
1
i i j1
n,
Take the expression of “c”:
Can you relate that to one property of
the 2-D polygon in X-Y plane?
a, b and c also describe the projection
surface of the polygon on the Y-Z, Z-X
and X-Y planes (or along the X, Y and Z
axis) respectively.
c (X1X2)(Y1Y2) (X2X3)(Y2Y3)
3XX
(X 1 (Y
1 )(Y
2 Y
3 Y
3 )X
1 ) 2(Y3Y1)X3(Y1Y2)
If A is the total area of the polygon, the
projected areas are:
COP
Each (X,Y,Z) point on a polygon
surface, corresponds to the orthographic
projection point (X, Y) on the view plane.
COP
Steps for Processing:
(a) Initialize
depth(X,Y) Zmax
(X,Y) refresh(X,Y) I
IB = background B
intensity
(b) For each position on each polygon surface:
depth (X, Y) = Z;
X X+1
Z X −C
Z X 1
A
; A
B
Z m ;
Z Y 1 Y C
For a vertical edge: Z’ = Z + B/C;
So to implement the algorithm, three
constants are required for each surface:
A
( m B)
B
C , C , C
A
4 4
4 4
Z-Buffer
values
9 8 9 8
8 7 4 7 8 7 4
4 7 6 5 4
Z-values of the 4 4 9 8 7 6 5
coordinates: 4 4 8 7 7 6 5
9 8
7 8 7 4
7 6 5 4
Z-Buffer
values
IMAGES (after pseudo-texture rendering)
V
V
Case Studies – examples of
(iii) (iv)
BSP (Binary Space Partition) trees
P1
P2 C
A
D
P1
B BP F B
FP
FP
BP
P2F P2B
F B B
BSP (Binary Space F
A C B D
Partition) trees
Salient features:
5a 5
2
3 5b
1 3
4
1 4
2
5b
5a
5
4
5a 5
2
3
5b
1 1
3 2
4
5
2
3
1 3
2 4 4
5a 1 5b
5a
5
2
V
5b 3
1
3 5b
4 2
1 5a 4
Also see:
Other applications:
potential visibility sets;
• Robot navigation
KD trees, R+-trees;
• Collision Detecion
Bounding Volume Hierarchy (BVH)
• GIS
and
Shadow Volume BSP Tree (SVBSP) • Image Registration
Display list of a BSP tree
• BSP tree may be traversed in a “modified in-
order tree” walk to yield a correctly
priority- ordered polygon list for an
arbitrary viewpoint.
• If the viewer is in the root polygon’s front
half space, the algorithm must first display:
1.All polygons in the root’s rear half-
space.
2.Then the root.
3.And finally all polygons in the front
half-space.
• Use back face culling
• Each of the root’s children is
recursively processed.
Disadvantages
Vview
N A, B, C
x, y
zv
May 2012
Z - Buffer
Algorithm
Initialize each pixel (x, y) of depth buffer and frame buffer (color):
May 2012
of pixel
Efficient Depth
Calculation
Given the depth value in a vertex of a polygon, the depth of any
other point in the plane containing the polygon can be
calculated efficiently (additions only).
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. If the plane intersects a polygon, divide the polygon at the plane.
3. Polygons are placed into a binary search tree with T as the root.