Skip to content

Backface Culling

theproadam edited this page Apr 24, 2020 · 4 revisions

Performance can be greatly improved by reducing the amount of pixels filled by skipping back faces. renderXF allows both front and backface culling. Culling is determined from the winding order of the triangle.

Enabling face culling

To enable backface culling, just use the SetFaceCulling() function from the renderX instance:

//Enable Face Culling:
GL.SetFaceCulling(true, boolFrontTrueBackFalse)

//Disable Face Culling:
GL.SetFaceCulling(false, boolFrontTrueBackFalse)

Cull front or back

To change from front face to backface culling or vice versa, just use the SetFaceCulling() function from the renderX instance:

//Change Face Culling To Backfaces:
GL.SetFaceCulling(true, false)

//Change Face Culling To Frontfaces:
GL.SetFaceCulling(true, true)
In certain scenarios floating point precision can result in flicking backfaces, this only occurs if the vertex is clipped twice at the same point by the horiontal and vertical clipping planes.