Clustered Decals vs Deferred Decals in DirectX

Clustered decals and deferred decals represent two distinct architectural paradigms for projecting surface details onto scene geometry in modern rendering engines. While traditional deferred decals rely on rasterizing proxy geometry to read from and write to the G-Buffer via standard pixel shaders, clustered decals assign decal volumes to a three-dimensional view-frustum grid, evaluating them alongside clustered lighting in forward or deferred pipelines. This fundamental shift affects how DirectX handles pipeline state transitions, memory bandwidth, compute shader culling, and shader execution.

Architectural Overview and Evaluation Pipeline

Deferred decals require the rendering engine to submit 3D bounding geometry (typically unit cubes) for each decal instance. In DirectX, this is executed by issuing draw calls that rasterize these volumes into the scene. The pixel shader reconstructs the world-space or view-space position of the underlying geometry by sampling the existing depth buffer (Texture2D<float> DepthTexture). The pixel shader then transforms this position into the decal’s local object space to determine UV projection coordinates and clip pixels falling outside the unit cube. The resulting material properties are blended directly into the G-Buffer targets via the Output Merger (OM) stage using hardware blending states.

Clustered decals bypass proxy geometry rasterization during the surface evaluation phase. Instead, decal bounding volumes are gathered, transformed, and culled into 3D view-space tiles (froxels) using DirectCompute compute shaders. The resulting decal indices are written into linear DirectX buffers (StructuredBuffer or ByteAddressBuffer). When scene geometry is shaded—whether during a G-Buffer base pass, a deferred lighting resolve, or a Forward+ pass—the pixel shader computes the cluster index for the current pixel, loops through the assigned decal indices, and accumulates their contributions procedurally in code.

DirectX Draw Calls and API Overhead

The deferred decal approach scales poorly with high decal density because each decal instance incurs API overhead unless aggressively instanced. Even with instanced draw calls (DrawIndexedInstanced), deferred decals require switching blend states in the Output Merger depending on whether a decal modifies albedo, normals, or roughness. When overlapping decals alter different material properties, pipeline state object (PSO) changes in DirectX 12 can cause significant CPU and GPU synchronization overhead.

Clustered decals decouple the number of active decals from the number of draw calls. Decal culling is handled in a unified compute dispatch (Dispatch), which groups decals and lights into identical spatial clusters. Decal application requires no additional draw calls, as evaluation is embedded into the existing geometry or lighting passes. This unified architecture significantly reduces PSO switching and state validation overhead.

Overdraw and Bandwidth Utilization

Deferred decals inherently suffer from overdraw. When multiple decals overlap on a single surface, the GPU executes pixel shaders and writes to the render targets for every overlapping layer. Because deferred decals rely on hardware read-modify-write operations on multiple render targets (MRTs), heavy decal clustering introduces high memory bandwidth bottlenecks and can saturate the GPU's ROP (Render Output Unit) throughput.

Clustered decals resolve all overlapping decals within a single shader invocation per screen pixel. Rather than writing to the G-Buffer multiple times, the shader iterates through the clustered decal index list, evaluates texture fetches from a texture atlas or bindless array (DescriptorIndexing in DX12), and computes the final blended result in registers before writing to memory once. While this increases ALU pressure and register allocation within the pixel shader, it drastically lowers off-chip memory bandwidth consumption.

Depth Testing and Normal Alignment

A major technical limitation of deferred decals is their reliance on the pre-existing depth buffer to project coordinates. Normal validation requires sampling the G-Buffer normal target to prevent decals from "bleeding" onto surfaces facing away from the projection axis. This involves manual angle-attenuation calculations inside the pixel shader using sampled normal vectors, which often produces artifacts on thin surfaces or complex geometry.

Clustered decals eliminate projection bleeding more efficiently because the evaluation occurs directly during the surface's own rasterization phase. The shader already possesses the true geometric normal, tangent space, and position of the current fragment, removing the need to reconstruct surface properties through additional texture fetches and matrix inversions.

Resource Binding and Shader Models

Under DirectX 12, clustered decals leverage advanced features such as root signatures with unbounded descriptor tables, bindless texturing, and wave intrinsics. A clustered system typically binds a global decal buffer (StructuredBuffer<DecalData>), a cluster offset grid, and a global texture array or descriptor table containing all decal textures. Shaders can use lane-divergence mitigation techniques via wave intrinsics (e.g., WaveActiveBitOr, WaveReadLaneFirst) to optimize texture sampling across warps/wavefronts when adjacent pixels access different decals in the cluster.

Deferred decals remain locked to traditional graphics pipelines, requiring static descriptor sets or rigid root arguments per draw call to handle distinct decal textures and normal maps, limiting scalability in complex, dense game environments.