TRAA vs SMAA Comparison (r183 roadmap)

Split-screen anti-aliasing comparison with temporal accumulation AA on the left and SMAA post-processing on the right for visual quality tradeoff analysis.

Key topics: three.js traa, temporal aa, smaa, anti-aliasing comparison, post-processing

Overview

Anti-aliasing removes the jagged, shimmering edges that come from sampling a continuous scene with a grid of pixels. Two popular post-process approaches take opposite routes: SMAA analyses a single frame for edge patterns, while temporal approaches combine several jittered frames over time. This split-screen demo runs a temporal accumulation technique on the left and SMAA on the right over animated, high-frequency geometry.

How it works

Temporal accumulation (left). Each frame the camera's projection is shifted by a small sub-pixel offset using setViewOffset, so successive frames sample slightly different points inside each pixel. The new frame is blended into a history buffer with a configurable history weight. Over several frames this averages many samples per pixel, approximating supersampling at little cost per frame. Without motion vectors to reproject the history, moving objects leave trails (ghosting), which is exactly why production TAA adds reprojection and neighbourhood clamping.

SMAA (right). Subpixel Morphological Anti-Aliasing runs as an SMAAPass in an EffectComposer. It detects edges by luminance contrast, classifies their shapes (L, Z and U patterns) using precomputed lookup textures, and blends pixels across the edge accordingly. It works on one frame, so it never ghosts, but it cannot recover detail smaller than a pixel.

Exploring the demo

With animation off, the left side becomes very smooth as samples accumulate. Turn animation on and the left side shows ghosting behind moving parts, while the right side stays crisp but shimmers on thin features. Raise the history weight for more smoothing and more ghosting; lower it for less of both. Increase the jitter to see the sub-pixel sampling directly.

Practical advice

SMAA is a safe, cheap default for most WebGL scenes. Temporal approaches give better results on fine detail and pair well with other temporal effects, but need motion vectors and clamping to be shippable. See a full implementation with neighbourhood clamping in TAA from scratch, and compare FXAA, SMAA and MSAA in the anti-aliasing demo.

What this code does

- Split-View Analysis: left half renders temporal accumulation AA (TRAA-style approximation), right half renders SMAA.
- Temporal Accumulation: combines current jittered frame with history buffer using configurable history weight.
- SMAA Reference: uses `SMAAPass` through `EffectComposer` as a crisp spatial anti-aliasing baseline.
- Motion Stress Test: animated high-frequency wireframe geometry exposes differences in shimmer, blur, and edge stability.
- Practical Use: helps evaluate AA strategy tradeoffs between temporal stability and fine detail sharpness.

Continue Learning

Related demos

Trending this week

Most popular