Beruflich Dokumente
Kultur Dokumente
Chapter 9
Visible Surface Detection Methods
Outline
2 approaches
Object-Space Method
Image-Space Method
Back-Face Detection
A polygon
l
is
i back
b k face
f
if C<=0
C 0
xview
zview
N(3,2,6)
B(0,3,0)
3 +2 +6 -6=0
3x+2y+6z
6 0
C(0 0 1)
C(0,0,1)
z
01074410 / 13016218 Computer Graphics
A(2,0,0)
x
6
Depth-Buffer Method
Image-space approach
A depth buffer
2.
Calculate the depth of any point on the plane containing the polygon
A surface position (x, y) from plane equation
z = (-Ax-By-D)/C
Depth
p z of (x+1,
(
, y)
z = [-A(x+1)-By-D]/C,
z = z-A/C
z = [-A(x-1/m)-B(y-1)-D]/C,
z = z+(A/m+B)/C
z = [-Ax-B(y-1)-D]/C,
[
( ) ]/
z = z+B/C
/
10
Scan-Line Method
Image-space method
Across each scan line, depth calculations are
performed to determine which surface is nearest to
the view plane at each position
An active list of edges is formed for each scan line
11
AB-BC, flag S1 on
EH-FG,
EH
FG, flag S2 on
AD EH, flag S1 on
AD-EH
EH-BC, flag S1,S2 on
Calculate depth
After BC, flag S1 off
Flag S2 on until FG
12
13
Depth-Sorting Method
This method
Thi
th d is
i often
ft referred
f
d to
t painters
i t
algorithm
14
z
zmax
S
zmax
zmin
zmax
zmin
zmin
zmin
No Depth Overlap
Depth Overlap
x
15
16
4
01074410 / 13016218 Computer Graphics
Surface S is completely
p
y
behind the overlapping
surface S
Overlapping
pp g surface S is
completely in front of
surface S, but S is not
completely behind S
Surface S extends to a
greater depth, but it
obscures surface S
S
01074410 / 13016218 Computer Graphics
18
BSP-Tree Method
19
BSP-Tree Method
20
BSP-Tree Method
5a
5
5b
3
1
4
1
2
5a
4
5b
21
BSP-Tree Method
5a
back
front
5b
3
front
1
4
5a
back
4
5b
1
22
BSP-Tree Method
5a
back
front
5b
3
front
1
4
5a
back
back
5b
23
Area-Subdivision Method
Image-space method
Take advantage of coherence, by locating
projection areas that represent part of a
single surface
By successively dividing the total viewplane
l
area into
i t smaller
ll and
d smaller
ll
rectangular
24
Yes, subdivide it
25
Surrounding surface
Overlapping surface
Inside surface
C
Completely
l l inside
i id the
h area
Outside surface
26
27
Once a surface
O
f
has
h been
b
identified
id tifi d as an outside
t id or
surrounding, it will remain in that category for all
subdivisions of the area
28
As a variation
In general,
general fewer
subdivisions are required,
but more p
processing
g is
needed to subdivide and to
analyze the relation of
surfaces
29
Octree Method
O l front
f t colors
l
d
Only
are saved
30
31
Ray-Casting Method
32
Depth-sorting
Depth
sorting or Octree
Depth-buffer
Ray-casting or Octree
O
low performance with simple scenes but high performance for complex scenes
Implemented in hardware
Parallel processing
33
34
Wire-Frame Surface-Visibility
Algorithms
35
Wire-frame Depth-Cueing
Algorithm
36
OpenGL Visibility-Detection
Functions
37
End of Chapter 9
38