In a real-time renderer, what do frustum culling, backface culling and occlusion culling each remove, and why are all three needed?
answer
- three different things can be invisible
- outside the view, facing away, hidden behind
- object level vs triangle level
- depth testing still pays for vertices
basics
~20 sFrustum culling drops whole objects outside the camera's view volume, backface culling drops triangles facing away from the camera, and occlusion culling drops objects hidden behind nearer geometry. Each removes work the other two cannot.
solid answer
~40 s**Frustum culling** tests each object's bounding sphere or box against the six planes of the view frustum and skips anything wholly outside, before any draw is issued. **Backface culling** is a per-triangle test done after vertex processing: the triangle's winding on screen says whether it faces away, and on a closed opaque mesh roughly half the triangles go before rasterization. **Occlusion culling** handles what both miss, objects inside the frustum but hidden behind a wall; in a dense city where the camera sees one street, thousands of buildings sit inside the frustum behind the facades. The depth buffer would hide them too, but only after their draws, vertices and rasterization have been paid for. All three are conservative: drawing something invisible wastes time, culling something visible is a bug.
go deeper
Name the three tests, say what each one throws away and at what granularity: whole objects for frustum and occlusion, single triangles for backface.
Explain where each test runs and what it saves: backface culling after vertex processing, the other two before a draw is issued, and why depth testing does not replace them.
Show you know where the time goes in a dense scene: frustum culling leaves everything behind nearby walls, so occlusion culling usually dominates the saving, and all tests must stay conservative.
Frame culling as a budget question: which tests a project can afford per frame, at what granularity, and which content rules (closed meshes, sensible bounds) keep them effective.
## Why a renderer culls at all A frame has a fixed time budget, and most of what a game world contains is not visible from any one camera position. **Culling** means deciding, as cheaply as possible, that some piece of work cannot affect the image and skipping it. Three different reasons make something invisible, and each has its own test: - it is **outside the view**: to the side of, above, below or behind the camera, or beyond the far plane; - it **faces away**: the back side of a closed surface; - it is **hidden behind** something nearer that is opaque. ## Frustum culling The camera sees a truncated pyramid called the **view frustum**, bounded by six planes (near, far, left, right, top, bottom). Testing every triangle against it would cost more than drawing them, so the test runs on a **bounding volume** per object: a sphere or a box that encloses the whole mesh. If the volume is entirely on the outside of any one plane, the object cannot be visible and is never submitted. Frustum culling usually runs on the CPU or in a GPU compute pass, often over a hierarchy so that a whole block of the world can be rejected with one test. ## Backface culling On a closed, opaque mesh, triangles on the far side of the surface are always covered by the near side. Each triangle is authored with a consistent **winding order** (clockwise or counter-clockwise when seen from the front). After the vertices are transformed and projected, the fixed-function stage before rasterization computes the triangle's signed area on screen; if the winding is reversed, the triangle faces away and is dropped. Two consequences matter: 1. It removes roughly half the triangles of a closed mesh, but only **after** their vertices were processed, so it saves rasterization and pixel work, not vertex work. 2. It must be **turned off** for open or two-sided geometry, such as leaf cards, flags or a single-sided cloth, or their back side disappears. ## Occlusion culling Frustum culling keeps everything inside the view volume, including objects behind a wall. In a city where the camera stands in one street, the frustum may contain thousands of buildings while the facades of a few dozen hide the rest. **Occlusion culling** tests objects against what is already known to be in front: a depth buffer from occluders, a downsampled depth pyramid, hardware occlusion queries, or precomputed visibility for interiors. It is usually the most expensive of the three tests to run, and in dense scenes usually the one that saves the most. ## Why the depth buffer is not enough The depth test does make hidden objects invisible, and early depth testing can skip shading their pixels. But by then the renderer has already issued the draw, processed every vertex and rasterized every triangle. Culling removes the object before any of that is spent. | Test | Granularity | Usually runs | Saves | |---|---|---|---| | Frustum | object, cluster or hierarchy node | CPU or compute pass, before submission | draws, vertices, pixels | | Backface | triangle | fixed-function, after vertex processing | rasterization and pixel work | | Occlusion | object or cluster | CPU or GPU, before submission | draws, vertices, pixels | ## Conservative by design Every culling test may keep something that turns out to be hidden (a **false positive** costs only time), but must never reject something visible (a **false negative** is a visible bug: an object vanishes or pops in late). Bounding volumes are looser than the meshes they enclose for exactly this reason, and an occlusion test that cannot decide, for example because an object crosses the near plane, reports it visible. ## Traps in practice - **Bounds that miss the motion**: an animated object whose bounds were computed in one pose, or a door swinging past its static box, can be culled while part of it is still on screen; bounds must cover the whole motion or be recomputed. - **Inconsistent winding**: a mesh exported with mixed winding loses scattered triangles to backface culling; the fix belongs in the content, not in turning culling off. - **Mirrored instances**: a negative scale flips the winding on screen, so the renderer must flip its front-face rule for those instances or they render inside out. - **One view only**: shadow and reflection views need their own culling against their own frusta, because an object outside the main camera's view can still cast a visible shadow.
- Why is backface culling turned off for foliage cards and cloth?Those surfaces are open: a single sheet of triangles that the player can see from both sides. Backface culling would drop the sheet whenever its back faced the camera, so leaves and capes would vanish as they turn. Such materials are drawn two-sided, often flipping the normal for the back side so lighting stays correct.
- Why test a bounding volume rather than the object's triangles?A sphere costs one distance comparison per plane and a box only a few more, while a mesh may have thousands of triangles. The test only has to be conservative: if the volume is outside, every triangle inside it is too. A loose volume costs an occasional wasted draw, never a wrong image.
- The depth buffer already hides occluded objects, so occlusion culling is pointless.
- Hardware backface culling removes triangles before their vertices are processed.
- Frustum culling tests each triangle against the camera's view.
- Backface culling is safe on every mesh, including leaves and flags.
- A culling test may reject an object if it is probably hidden.