HTML and CSS Reference
In-Depth Information
Backface culling
Backface culling was mentioned a couple of times in the previous chapter, and now you find out what it is
all about and exactly how it works.
Remember that in the earlier models, you made all the color fills semitransparent. The reason for this was
that you were always drawing every polygon, and you had no control over what order they were drawn in.
So a polygon on the back of the model might get drawn on top of one on the front of the model, creating
some odd looking results. Giving every face an alpha value of 50% made them all relatively equal and let
us put off this discussion while you concentrated on your modeling techniques. Now, you are going to deal
with it.
In principle, backface culling is simple. You draw the polygons that are facing you, and you don't draw the
ones that are facing away from you. The tricky part is determining which are which.
You were constantly reminded to define the points of each polygon in a clockwise direction. Even though
that is unnecessary for the examples so far, you now see why this is so important, and why it is good to
get into the habit from the start.
It's an interesting observation that if the points of a polygon are arranged in a clockwise fashion when the
triangle is facing you, they are counterclockwise when the polygon is facing away from you. You can see
this demonstrated in Figure 17-1, which has a triangle facing you. (A note on terminology in this topic: For
the most part, “polygon” is used as a general term, and “triangle” for a specific triangular polygon under
discussion.)
A
B
C
Figure 17-1. A triangle facing you has points in a clockwise direction.
In Figure 17-2, the triangle has been rotated so it is facing in the opposite direction.
A
B
C
Figure 17-2. A triangle facing away from you has points in a counterclockwise direction.
 
Search WWH ::




Custom Search