As rendering lead, how do you choose a project's shading architecture: deferred, Forward+ or clustered forward, or a visibility buffer?
answer
- constraints before fashion
- weakest target's bandwidth
- anti-aliasing policy and materials
- triangle density and quads
- prototype the worst scene
basics
~20 sNo architecture wins everywhere, so choose from measured constraints. Deferred suits many lights, uniform materials and screen-space effects; clustered forward suits MSAA, varied materials and transparency; a visibility buffer suits very dense geometry. Prototype the worst scene on the weakest target.
solid answer
~50 sI start from constraints: the weakest target's bandwidth and whether its GPU is tile-based, the resolution and anti-aliasing policy (hardware MSAA for thin geometry or head-mounted displays pushes toward forward), light counts in the worst scene, how varied the material models are, how much of the frame is transparent, which screen-space effects need normals, and how dense the geometry is. Deferred gives cheap many-light lighting and free inputs for screen-space effects, but costs G-buffer bandwidth and a fixed material menu. Clustered forward keeps MSAA, per-material shaders and one lighting path for transparents, at the cost of a second geometry pass and lighting wasted in partly covered pixel quads as triangles shrink. A visibility buffer writes a few bytes per pixel and suits micro-triangles, but needs vertex refetch and material sorting. I prototype the worst scene on the weakest hardware, measure, and pick one primary path, because maintaining two is expensive.
go deeper
Recall the three families and one strength of each: deferred for many lights, forward for MSAA and transparency, visibility buffer for dense geometry.
Explain what each architecture writes per pixel and which passes read it, so its costs follow from the data rather than from slogans.
Bring measurements: bytes per pixel, lights per tile, quad efficiency and worst-scene frame cost on the weakest target, and name the constraint that dominates.
Own the call as a project-wide contract: weigh hardware tiers, anti-aliasing policy, material variety and the cost of maintaining paths, and set triggers for revisiting it.
## There is no default answer The **shading architecture** decides what the frame stores per pixel and which passes read it. It shapes every material, every light type, transparency, anti-aliasing and every screen-space effect, so changing it late is expensive. Three families dominate: - **Deferred**: a G-buffer of surface attributes, then lighting from it, usually with tiled or clustered light lists. - **Forward+ or clustered forward**: a depth pre-pass, per-region light lists, then a forward pass in which each material's own program lights itself. - **Visibility buffer**: the geometry pass writes only depth and an ID naming the instance and triangle; a later pass reconstructs the surface at each pixel and shades it. ## The constraints to gather first - **Weakest target hardware**: memory bandwidth, and whether the GPU renders in tiles with on-chip memory. - **Resolution and anti-aliasing policy**: hardware MSAA for thin geometry or head-mounted displays, or post-process and temporal anti-aliasing with upscaling. - **Lights**: how many, how large, and how many overlap a pixel in the worst scene. - **Material variety**: one physically based model with a few variants, or many unusual shading models such as hair, skin, cloth or stylised looks. - **Transparency share**: glass-heavy or particle-heavy scenes spend much of the frame in a forward path whichever architecture is chosen. - **Screen-space effects**: ambient occlusion, reflections and decals that want normals and roughness. - **Geometry density**: GPUs shade pixels in 2x2 quads, so triangles covering a pixel or two waste much of that work. - **Team and tools**: what the team can build, debug and keep consistent across hundreds of materials. ## How the three compare | | Deferred, tiled or clustered | Clustered forward | Visibility buffer | |---|---|---|---| | Written per pixel by geometry | many bytes of attributes | depth, optionally thin normals | depth plus a packed ID | | Many lights | good | good | good, with the same lists | | Hardware MSAA | expensive | native | feasible, since per-sample IDs are small | | Material variety | limited by shared channels | each material its own program | per-material dispatch or one large shader | | Transparency | separate forward path | same path and lists | separate forward path | | Screen-space inputs | free | need a thin extra buffer | reconstructed or written separately | | Micro-triangles | attribute writes waste quad lanes | lighting wastes quad lanes | shading runs per pixel, no quad waste | | Tile-based GPUs | good if the G-buffer stays on-chip | good | small footprint, but shading fetches vertices | ## The visibility buffer in brief 1. Draw all opaque geometry, writing depth and a packed instance-and-triangle ID per pixel. 2. Optionally classify screen tiles by the materials they contain, so each material's work can be dispatched together. 3. For each pixel, fetch the triangle's three vertices, recompute the pixel's barycentric coordinates, interpolate attributes, and compute texture-coordinate derivatives analytically, because there is no 2x2 quad of neighbours to difference. 4. Evaluate the material and lighting, writing lit colour, or a compact G-buffer in a hybrid design. It shines when triangles are tiny and bandwidth is scarce. It costs vertex refetch, re-running or caching any vertex deformation, and the complexity of material sorting. ## Making the decision 1. **Write down the constraints** above, with numbers for the weakest and the strongest targets. 2. **Build the worst scene early**: a night market at full light count, the densest foliage, the most glass. 3. **Prototype the candidates** on the weakest target and measure frame cost, memory and bandwidth in the worst views, not only averages. 4. **Choose one primary path** plus the exceptions it needs, usually a forward path for transparents and special materials. Two complete architectures double every material, light type and effect. 5. **Share what does not depend on the choice**: light lists, the BRDF and material parameters, so a later switch or a per-tier split stays affordable. 6. **Record triggers for revisiting**: a new hardware tier, a change in anti-aliasing policy, or a content direction with much denser geometry or more transparency. Two well-run projects can reach opposite answers from different constraints, which is why this is a lead's call rather than a textbook fact.
- When does a visibility buffer beat a classic G-buffer?When geometry is dense enough that many triangles cover a pixel or two, when bandwidth is scarcer than arithmetic, or when MSAA is wanted, since each sample stores only an ID and depth. It loses when vertex refetch and re-interpolation dominate, as with expensive deformation that must be recomputed or cached, or when material variety splits per-material dispatch into many small passes.
- Is it reasonable to ship different shading architectures on different hardware tiers?It can be, for example deferred on high-bandwidth hardware and clustered forward on tile-based or low-bandwidth targets, but every material, light type and effect then needs two implementations and two test passes, and visual parity drifts. Sharing light lists, the BRDF and material parameters keeps the split cheaper. Many teams accept it only when one path cannot meet the weakest tier's budget.
- What would make you revisit the decision mid-project?A change in its inputs: a new target with very different bandwidth, a new anti-aliasing policy, a content direction with much denser geometry or more transparency, or measurements showing the chosen path cannot meet budget in the worst scene. Because the architecture shapes every material and effect, revisit it deliberately at a milestone with prototypes, not through a drift of special cases.
- Deferred is always faster than forward once a scene has more than a few lights.
- Forward+ cannot support screen-space effects because it never has normals.
- A visibility buffer removes the cost of material shading.
- Reuse the last project's architecture; switching later is cheap.
- Tile-based mobile GPUs cannot run deferred shading at all.