Hidden Surface Removal Algorithms
Hidden Surface Removal Algorithms
3D-Clipping
Projection
Normalized view space
Scan conversion, Hiding
Image space,
July 18, 2023 Computer Graphics Device coordinates 2
Image
Contents
1. Introduction
2. Methods
Introduction
Need for Hidden Surface Removal
• We must determine what is visible within a scene
from a chosen viewing position
• For 3D worlds this is known as visible surface
detection or hidden surface elimination
Ax By Cz D 0
where A, B, C & D are the plane parameters for the surface
• When an inside point is along the line of sight to the surface,
the polygon must be a back face.
• It is also called culling.
• This is an object space method.
If C = 0, our viewing
direction is grazing that
polygon.
Hence Back face means
C≤0
y scan line
y - 1 scan line
x x’
July 18, 2023 Computer Graphics 17
Depth-Buffer Algorithm
Calculating Depth
• At any surface position the depth is calculated from the plane
equation as:
Ax By D
z
C
• Horizontally: For any scan line adjacent x positions differ by
±1, as do adjacent y positions
A( x 1) By D A
z' z' z
C C
P1
Screen
July 18, 2023 Computer Graphics 22
Depth-Buffer Algorithm
July 18, 2023 Computer
Graphics 23
Depth-Buffer Algorithm
• Non Trivial Example
– Rectangle: P1(10,5,10), P2(10,25,10), P3(25,25,10), P4(25,5,10)
– Triangle: P5(15,15,15), P6(25,25,5), P7(30,10,5)
– Frame Buffer: Background 0, Rectangle 1, Triangle 2
– Z-buffer: 32x32x4 bit planes
It is the same edge table that you have constructed in scan line
polygon fill algorithm.
I. Initialization
a. Initialize the AEL to empty
b. Initialize each screen pixel to background color
c. Set y = first non empty cell value in the edge list.
Repeat step I and II until no further processing can be
performed on AEL
III. X-Scan Loop: Process from Left → Right, each edge of AEL, as
follows
a. Invert IN/OUT flag of polygons in polygon list which contain the
edge.
b. Update APL to contain only those polygons whose IN/OUT flag is
set to IN.
Go to step II
1 M M 1
1
1 M M
0 0 0 0
1 1 0 0
1 M M 1
1 M M M
0 1 1 1
M M M 1
M M M M
M M M M 1 1
M M M M M 0
A
E
+X -X
E1
B
+X -X
EYE 2
Ouch