Game Development Reference
In-Depth Information
3.8C ULLING
Culling refers to the culling of faces that may not be visible to the player, any triangles that
are facing away fromthe player'scamera are called back facing triangles andasanoptimiz-
ation the video hardware is able to skip drawing it, culling it before it reaches the rasterizer
stage. There are three options available to enable culling and they require some knowledge
about how the geometry was built.
None
Noculling,thismeansnotriangleswillbeculled,evenifthey'refacingawayfromthecam-
era, sometimes this is necessary, an example is when rendering primitives in wireframe, if
we want to be able to see the full shape of the primitive, we can disable culling.
Clockwise
The name clockwise refers to the order in which a face is created, if the order of the vertices
to draw was defined in clockwise order, any back facing vertices will be culled.
Figure 35 - Clockwise winding order of a triangle's vertices.
The ordering of the vertices is determined either by the order they appear in the vertex buf-
fer,ortheorderoftheindicesintheindexbuffer,ofifdrawinginimmediatemode,theorder
of function calls.
Using a vertex buffer:
vertex_type vertices[] = {
{0,0,0},
{0,1,0},
{1,0,0} }; // clockwise winding order
Using indices:
Search WWH ::




Custom Search