SurfaceDetectionMethods Rev 2020
SurfaceDetectionMethods Rev 2020
of
28
of
28
12
Depth-Buffer Method (cont…)
13
of
28
Depth-Buffer Algorithm
1. Initialise the depth buffer and frame buffer
so that for all buffer positions (x, y)
depthBuff(x, y) = 0
frameBuff(x, y) = bgColour
14
of
28
Depth-Buffer Algorithm (cont…)
2. Process each polygon in a scene, one at
a time
– For each projected (x, y) pixel position of a
polygon, calculate the depth z (if not already
known)
– If z > depthBuff(x, y), compute the surface
colour at that position and set
depthBuff(x, y) = z
frameBuff(x, y) = surfColour(x, y)
After all surfaces are processed depthBuff
and frameBuff will store correct values
15
of
28
Calculating Depth
At any surface position the depth is
calculated from the plane equation as:
y scan line
y - 1 scan line
x x’
20
of
28
A-Buffer Method
The A-buffer method is an extension of the
depth-buffer method
The A-buffer method is visibility detection
method developed at Lucasfilm Studios for
the rendering system REYES (Renders
Everything You Ever Saw)
21
of
28
A-Buffer Method (cont…)
The A-buffer expands on the depth buffer
method to allow transparencies
The key data structure in the A-buffer is the
accumulation buffer
22
of
28
A-Buffer Method (cont…)
of
28
30
Scan Line Method Example
31
of
28
Scan-Line Method Limitations
The scan-line method runs into trouble when
Images taken from Hearn & Baker, “Computer Graphics with OpenGL” (2004)