Vertex Ordering and Culling – Interactive 3D Graphics


3-D computer graphics uses an interesting concept to speed up object display called backface culling. Imagine you’re looking at a box. Here’s the side view in 2-D. Only the sides of the box that face toward you are visible. The backfaces here and here do not need to be rendered. The fastest polygon to render is the one you don’t ever have to render at all. Backface culling can throw away about half the faces in an object, so it’s a worthwhile optimization. For example, here’s a real live box. If you look at it from any angle, you’re only gong to see a few of the faces of the whole box, and the rest of the faces can be thrown away. Backfaces can be culled for any solid object. This V-shape seen from the side has only two sides facing towards the camera, outlined green. These other two faces can be thrown away without further processing. It turns out this green face here is hidden from view by this front face, but we let the z buffer take care of hiding that. We can set whether backface culling is enabled or disabled, but how do we determine if a triangle is a frontface or a backface? There are three points defining each triangle, and there is no flag stored for additional information. What determines front or backfacing is the order of the vertices after they are protected on to the screen. In WebGL, if the order is counterclockwise, the triangle is frontfacing. If its clockwise, its backfacing. Going counterclockwise like this is often called the right-hand rule. The fingers of your right hand wrap around the edges of the triangle in order. If your thumb points at you, the triangle is then frontfacing.

Leave a Reply

Your email address will not be published. Required fields are marked *