Back-face Culling
[Hill: 406.407. Foley & van Dam: p. 663-664]
Back-face culling directly eliminates polygons not facing
the viewer.

Back-Face Culling in VCS
Back-face culling can be performed in either VCS or NDCS.
We'll first discuss face-culling in VCS.
A first attempt at performing back-face culling might directly
use the z-component of the surface normal, as expressed in VCS.
This does not always work, however.

A better strategy is to construct the plane equation for the polygon
and to test whether the eye-point falls above or below this plane.
Plane(Peye)<0 implies the eyepoint is below the plane
containing the polygon and that the polygon should thus be culled.
Summary for VCS culling
- Calculate a surface normal, N = (A,B,C).
This need not be normalized.
- Compute D in plane equation by substituting any polygon vertex
into the plane equation.
Plane(P) = Ax + By + Cz + D = 0
- Calculate Plane(eyept) to determine if eye is above
or below.
This corresponds to checking the sign of D.
Face Culling in NDCS
In NDCS, the z-component of the surface normal does reflect the true
visibility, as desired. If the z-component is positive, the normal
points away from the eye and the polygon should thus be culled.
Computing Surface Normals
[Hill: 347-350]
In order to do the face culling, we need a surface normal.

Method 1
Use the cross-product of two polygon edges.
The order in which vertices are stored should be consistent.
For example, if polygon vertices are stored in CCW order when
viewed from above the `front face', then we could use
N = ( P2 - P1 ) x ( P3 - P2 )
Method 2
A more robust method is to use the projected area
onto the yz, xz, and yz planes.
To see that areas can be used to calculate a normal, first consider the
2D case.

The areas for the required 3D projections (and thus the components of
the normal) can be calculated as follows:

