Reducing TAA Ghosting in Fast-Paced Game Development
Temporal Anti-Aliasing (TAA) smooths jagged edges by accumulating pixel samples across multiple frames, but high-speed motion often creates distracting trails known as ghosting. Developers mitigate this artifact in fast-paced games by combining high-precision motion vectors, color neighborhood clamping, dynamic blend weighting based on velocity, and custom reactive masks. By accurately detecting disocclusions and aggressively discarding invalid historical data, game engines maintain edge stability without sacrificing visual clarity during rapid movement.
1. Generating Precise Velocity Buffers
The foundation of effective TAA is an accurate 2D screen-space velocity buffer (motion vectors). Ghosting occurs when the engine samples the wrong historical pixel location.
- Include All Motion Sources: Motion vectors must account for camera translation and rotation, rigid object transforms, skeletal mesh animations, and vertex-shader deformations (e.g., wind sway on vegetation).
- Subtract Sub-Pixel Camera Jitter: Because TAA shifts the projection matrix every frame with sub-pixel offsets (jittering), developers must explicitly subtract the current and previous frames' jitter offsets from the calculated velocity vector. Failure to do so misaligns the historical sample.
- Dilate Motion Vectors: Foreground objects moving across static backgrounds often cause background pixels near silhouettes to pick up zero velocity, leading to trailing streaks. Applying a 3x3 "closest depth" cross-search around the pixel ensures the moving silhouette's velocity takes precedence over the background.
2. Color Neighborhood Clamping and Clipping
When an object moves, it reveals background pixels that did not exist in the previous frame (disocclusion). Blending this stale history causes ghosting.
- AABB Clamping in Color Space: Sample the 3x3 pixel neighborhood of the current frame and construct an Axis-Aligned Bounding Box (AABB) using the minimum and maximum color values. The historical color is then clamped or clipped to stay within this bounding box.
- Transform to Perceptual Color Spaces: Performing AABB clipping in RGB space often introduces color fringing. Developers convert colors to luminance-chrominance spaces such as YCoCg or \(\text{IC}_t\text{C}_p\). Clamping tightly along the luma axis eliminates brightness ghosting while preserving anti-aliasing on subtle color transitions.
- Variance Clipping: Instead of absolute min/max limits—which can be overly broad—calculate the mean and standard deviation (\(\sigma\)) of the 3x3 color neighborhood. Constraining the historical color to \(\mu \pm \gamma\sigma\) (where \(\gamma\) typically ranges from 0.75 to 1.5) provides tighter boundaries around dynamic edges.
3. Dynamic and Velocity-Dependent Blend Factors
Standard TAA uses an exponential moving average to blend the current frame (\(C\)) and the reprojected history (\(H\)):
\[\text{Output} = \alpha C + (1 - \alpha) H\]
In static scenes, a low \(\alpha\) (e.g., \(0.05\) to \(0.1\)) provides maximum temporal stability. In high-speed scenes, developers dynamically modify \(\alpha\):
- Velocity-Scaled Blending: Increase \(\alpha\) proportionally to pixel velocity. Faster-moving objects lean more heavily on the current frame, resolving motion instantly rather than trailing behind.
- Luminance Difference Scaling: If the contrast between the clamped history sample and the current sample is large, temporarily increase \(\alpha\) to force a rapid update.
4. Depth and Geometric Disocclusion Testing
Relying solely on color clamping can fail on uniform backgrounds. Geometric validation confirms whether the reprojected sample represents the same surface:
- Depth Comparison: Compare the current pixel's linear depth with the reprojected historical depth. If the difference exceeds a small adaptive threshold, the historical pixel is marked as an occluded surface and discarded (\(\alpha = 1.0\)).
- Normal Buffer Checks: Comparing surface normal vectors between frames further detects when a thin object has rapidly rotated or moved out of alignment.
5. Reactive and Transparency Masks
High-frequency visual elements such as particle effects, semi-transparent glass, fire, and post-process motion blur do not produce reliable motion vectors.
- Reactive Masks: Developers render a single-channel mask where transparent materials and fast particle effects write a bias factor. TAA reads this mask to increase \(\alpha\) directly for those pixels.
- Separate Overlay Passes: Non-diegetic UI elements, crosshairs, and screen-space overlays are rendered after the TAA pass to prevent fast player rotations from smearing UI graphics.
6. Post-TAA Sharpening
Because discarding historical samples to prevent ghosting can reintroduce slight temporal aliasing or softness, modern pipelines apply an edge-aware contrast pass, such as Contrast-Adaptive Sharpening (CAS), immediately after temporal accumulation. This restores high-frequency detail across fast-moving silhouettes without exacerbating edge artifacts.