1. May 2012 1
Back-Face Detection
( )A point , , is behind a polygon surface if 0,
where , , and are the plane parameters of the polygon. Test is
simplified by considering normal of face and viewing direction.
x y z Ax By Cz D
A B C D
+ + + <
( ), ,A B C=N
viewV
( )
view
view
A polygon is back face if 0. In a right-handed
viewing system viewing direction is along negative axis,
0,0, 1 . Then, a polygon is a back face if 0.
z
C
× >
= − ≤
V N
V
2. May 2012 2
Depth-Buffer Methods
Three surfaces overlapping pixel position (x,y) on the view plane.
The visible surface, S1, has the smallest depth value.
vx
vy
vz
3S
2S
1S
( ),x y
view plane
3. May 2012 3
( )
( )
Initialize each pixel ( , ) of depth buffer and frame buffer (color):
, 1. // Z is normalized to [0,1.0]
//
0;
, background color; initialize
for ea
to backgroun
h
d
c p
x y
depthBuf x y
frameBuf x y
=
=
Z - Buffer Algorithm
( )
( ) ( )
( )
olygon {
for each pixel , polygon {
if
// traverse all polygons
// rasterization
//( , , ) {
get (compute) , ;
check closer pixel
// compute color of pixel
x y
z x y depthBuf x y
color x y
d
∈
>
( ) ( ) ( ) ( ), , ; , , ;
}}}
epthBuf x y z x y frameBuf x y color x y= =
4. May 2012 4
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).
( )
( ) ( )
Depth is calculated from plane equatuion .
At rasterization along scan-line changes by 1. Therefore,
1 1 , and the ratio
is constant for the entire polygon.
z Ax By D C
x
z x A x By D C z A C A C
= − − −
±
+ = − + − − = − −
5. May 2012 5
A-Buffer Method
It is named so since z-buffer is used for depth semantics and in
some sense a-buffer has the nature of the other end of alphabet. It
is an extension using antialiasing, area-averaging visibility
detection method, supporting transparency.
background opaque
surface
foreground
transparent surface