Backface culling

On this page 7

Backface culling is a rendering optimization that discards polygons facing away from the camera before they are rasterized, because on a closed, opaque object those faces are always hidden behind the front surface. In Real-time 3D, it is one of the cheapest and oldest techniques for reducing GPU work, and it typically removes roughly half of the triangles of a closed mesh from the rasterization stage.

The test is performed per triangle by the fixed-function hardware of the GPU, after the vertex shader and before rasterization. It sits alongside frustum culling and occlusion culling as part of a layered visibility strategy, but unlike them it needs no scene knowledge beyond the triangle itself.

How backface culling decides which faces to drop

Every triangle has a front side and a back side, defined by its winding order: the sequence in which its three vertices are listed. By convention, a triangle whose vertices appear counterclockwise on screen is front-facing in OpenGL and WebGL, while Direct3D defaults to clockwise as front-facing. Both conventions can be switched.

Modern GPUs evaluate winding after projection, using the signed area of the triangle in screen space. If the sign indicates a back face and culling is enabled for back faces, the triangle is dropped and generates no fragments, so no fragment shader runs for it.

An equivalent object-space formulation compares the face normal with the view vector: when their dot product is positive in the appropriate convention, the face points away. The screen-space test is preferred in hardware because it is exact after perspective projection.

The table below shows the culling modes exposed by the main graphics APIs.

ModeFaces discardedTypical use
BackFaces pointing away from the cameraDefault for closed opaque meshes
FrontFaces pointing toward the cameraShadow map passes and inverted hulls
NoneNo facesFoliage, cloth and thin planes
Front and backAll polygonsRare, for passes needing only points or lines
Culling modes in common graphics APIs

Backface culling compared with other culling methods

Backface culling works at the level of individual triangles, whereas frustum culling and occlusion culling usually work on whole objects or clusters. The methods complement each other: an engine first removes objects outside the view, then hidden objects, and the GPU finally removes back faces of whatever remains.

This comparison summarizes where each method runs and what it costs.

MethodGranularityWhere it runsCost
Backface cullingPer triangleGPU fixed-function stageAlmost free
Frustum cullingPer object or clusterCPU or compute shaderLow
Occlusion cullingPer object or clusterCPU, GPU queries or precomputed dataModerate
Depth testingPer fragmentGPU after rasterizationPaid for every fragment
Visibility culling methods in real-time rendering

An important distinction is that backface culling does not resolve visibility on its own. A concave object, such as a cup, still has front-facing faces that hide one another, so the Z-buffer remains necessary. Culling only reduces how many triangles reach the depth test.

Performance gains and where they come from

The savings appear mainly in rasterization, fragment shading and memory bandwidth, not in vertex processing, because vertices are already transformed when the test happens. The benefit is therefore largest in scenes that are fill-rate or fragment bound, and smaller when the bottleneck lies in draw calls or vertex shading.

In practice, back faces of a closed mesh would usually fail the depth test anyway, so the gain is not a doubling of performance. The real saving is the avoided triangle setup, rasterization and early depth work, which matters most for dense meshes with many small triangles.

Some modern engines go further with cluster-based cone culling, where a compute or mesh shader rejects whole groups of triangles whose normals all point away from the camera. This moves the same principle earlier in the pipeline, saving vertex work as well.

When to disable backface culling

Backface culling assumes closed, opaque geometry. Whenever the back side of a surface can legitimately be seen, culling must be disabled or the geometry must be modeled with explicit back faces. The decision table below covers the common cases.

Asset typeRecommended settingReason
Closed opaque meshCull back facesBack faces are never visible
Leaves and grass cardsCulling off, two-sided shadingBoth sides are seen from different angles
Cloth and flagsCulling off or duplicated facesInside and outside are both visible
Transparent objectsTwo passes, back then frontCorrect blending of inner surfaces
Inverted hull outlinesCull front facesOnly the enlarged back shell is drawn
SkyboxesDepends on winding of the boxThe camera sits inside the mesh
Deciding on culling by asset type

Two-sided materials in engines such as Unreal Engine, Unity, Three.js and Babylon.js disable culling for a single material. When doing so, the shader must also flip the normal for back faces, otherwise lighting on the reverse side appears wrong.

Common mistakes and symptoms

Most culling problems come from inconsistent winding or flipped normals introduced during modeling or export. The symptoms look dramatic but the fixes are usually simple.

SymptomLikely causeFix
Missing faces on a modelFlipped normals or reversed windingRecalculate normals outward before export
Object visible only from insideEntire mesh invertedFlip all faces or invert the culling mode
Mirrored model renders inside outNegative scale reverses windingApply scale or flip winding in the engine
Single-sided leaves disappearCulling left on for cardsEnable a two-sided material
Culling symptoms, causes and fixes

A frequent export trap involves negative scale. Mirroring an object by scaling it by minus one reverses the winding order, so engines must detect the negative determinant of the transformation matrix and swap the culling mode, which most modern engines do automatically.

The short version

Think of a closed box on a table. From where you stand, you can never see the inner side of its far walls, because the front walls are in the way. Backface culling tells the computer not to draw what can never be seen.

Each flat piece of a 3D model has a front and a back. If the back is facing you, the graphics card simply skips that piece. This saves considerable work at no cost, which helps games and interactive scenes run smoothly.

Where it makes a difference

A web developer builds a product configurator in Three.js that shows a sneaker model of about 400,000 triangles on mid-range phones. With culling disabled by an imported material setting, the frame rate on a test phone hovers around 35 frames per second.

The developer switches the shoe body materials back to single-sided rendering with back-face culling, keeps two-sided rendering only for the thin laces and the inner tongue, and fixes a mirrored sole that rendered inside out due to negative scale. The frame rate rises to a steady 60 frames per second on the same phone, and the visual result is unchanged because the culled faces were never visible in the first place.