Home / Computer Graphics / Back Face Algorithm

Back Face Algorithm

Back Face Algorithm

Back Face detection, also known as Plane Equation method, is an object space method
in which objects and parts of objects are compared to find out the visible surfaces.

Let us consider a triangular surface that whose visibility needs to decided. The idea is
to check if the triangle will be facing away from the viewer or not. If it does so, discard
it for the current frame and move onto the next one.
Each surface has a normal vector. If this normal vector is pointing in the direction of
the center of projection, then it is a front face and can be seen by the viewer. If this
normal vector is pointing away from the center of projection, then it is a back face and
can not be seen by the viewer.

A fast and simple object space method for locating back faces

A point ( x,y,z ) is “inside” a polygon surface with plane parameters A, B, C, D if :

Ax + By + Cz + D = 0
When an inside point is along the line of sight to the surface, the polygon must be a
back face and so cannot be seen.

The test is simplified by considering the normal vector N (create 90 0 angle to surface)
to the polygon and the viewing vector V

This is back face if V·N > 0
A polygon is a back face if V view .N > 0. But it should be kept in mind that after
application of the viewing transformation, viewer is looking down the negative Z axis.
Therefore, a polygon is back face if :
(0, 0,1).N > 0 or if C < 0

In a right handed viewing system with viewing direction along the negative Z v axis , the
polygon is a back face if C < 0. Also, we cannot see any face whose normal has z
component C = 0, since your viewing direction is towards that polygon. Thus, in general,
we can label any polygon as a back face if its normal vector has a z component value −
C <= 0
Algorithm for right handed system :
1) Compute N for every face of object.
2) If (C.(Z component) < 0)
then a back face and don’t draw
else
front face and draw
Thus, for the right
handed system, if the Z component of the normal vector is negative,
then it is a back face. If the Z component of the vector is positive, then it is a front face.

Similar methods can be used in packages that employ a left handed viewing system. In these
packages, plane parameters A, B, C and D can be calculated from polygon vertex coordinates
specified in a clockwise direction (unlike the counterclockwise direction used in a right handed
system).

Also, back faces have normal vectors that point away from the viewing position and are identified
by C >= 0 when the viewing direction is along the positive Z v axis.

By examining parameter C for the different planes defining an object, we can immediately identify
all the back faces.

Algorithm for left handed system :
1) Compute N for every face of object.
2) If (C.(Z component) > 0)
then a back face and don’t draw
Else
front face and draw
The Back
face detection method is very simple. For the left handed system, if the Z component of the
normal vector is positive, then it is a back face. If the Z component of the vector is negative, then it is
a front face.

Limitations :
1) This method works fine for convex polyhedra, but not necessarily for concave
polyhedra.
2) This method can only be used on solid objects modeled as a polygon mesh.