Polygon CullingPolygon culling is the process of eliminating 3D polygons that lie outside the viewer's field of vision. It is more efficient than discarding polygons through 3D clipping because we can test for visibility without performing 3D transformation. While polygon culling is not strictly necessary, programs that perform polygon culling almost always achieve a higher frame rate. The simplest culling technique is to eliminate polygons that lie behind the viewer. We can check for such polygons with fg_3Dbehindviewer(), which determines if a given 3D world space point is behind the viewer. Depending on the level of sophistication you want to implement, the test point might be the polygon's center, its nearest or farthest point, or even a random vertex. When fg_3Dbehindviewer() finds a polygon behind the viewer, we simply skip that polygon when rendering the current frame. The first three fg_3Dbehindviewer() parameters are the 3D world space (x,y,z) coordinates for the test point, and the final parameter is a tolerance value that defines the visibility extent. The tolerance can be negative to specify the distance behind the viewer beyond which points are invisible, or positive to specify the distance in front of the viewer beyond which points are visible. You must be careful to select a suitable tolerance to avoid culling polygons that are partially visible. Consider a 3D polygon that extends 20 units behind and 10 units in front of the viewer. If we use a zero tolerance and test the polygon's center, we'll incorrectly eliminate the polygon. Instead, a tolerance of 10 would not eliminate the polygon, and we would rely on 3D clipping to render only the part in front of the viewer.

copyright 2001 Ted Gruber Software, Inc.