Skip to main content

Temporal Antialiasing

Accumulate jittered samples from successive frames while following scene motion and rejecting invalid history. createTAAShaderPassPipeline combines velocity reprojection, depth validation, and neighborhood clamping to reduce spatial aliasing and temporal shimmer.

GitHub

At a Glance

PropertyValue
ExportcreateTAAShaderPassPipeline
BackendWebGPU
Render passesThree: temporal resolve, resolved-color copy, and depth-history copy
Required bindingsdepthTexture and velocityTexture
Persistent stateRenderer-owned color and depth history textures

Usage

import {ShaderPassRenderer} from '@luma.gl/engine';
import {createTAAShaderPassPipeline, toneMapping} from '@luma.gl/effects';

const renderer = new ShaderPassRenderer(device, {
colorFormat: 'rgba16float',
shaderPasses: [createTAAShaderPassPipeline(), toneMapping]
});

renderer.renderToScreen({
sourceTexture: gBuffer.colorTexture,
bindings: gBuffer.getShaderPassBindings(),
uniforms: {
taaResolve: {
historyWeight: 0.9,
depthThreshold: 0.01,
currentJitter,
previousJitter
}
},
resetHistory: cameraCut
});

Parameters

ParameterDefaultDescription
historyWeight0.9Fraction of valid accumulated history retained in the resolved color.
depthThreshold0.01Maximum allowed difference between current and reprojected previous depth.
currentJitter[0, 0]Current projection jitter in normalized image coordinates.
previousJitter[0, 0]Previous projection jitter in normalized image coordinates.

The history weight is limited to 0.98. The application must render the source scene with the same projection jitter and provide matching velocity and depth attachments every frame.

How It Works

  1. Move each current pixel into the previous frame with its velocity and jitter delta.
  2. Reject history outside the screen or across a depth disocclusion.
  3. Clamp valid history to the current 3-by-3 color neighborhood.
  4. Blend the current color and bounded history, then save current depth for the next frame.

Call renderer.resetHistory() or pass resetHistory: true after resize, camera cuts, abrupt scene replacement, or invalid velocity generation.

  • FXAA smooths one display image without history or auxiliary attachments.
  • Camera-Reprojection Antialiasing derives motion from camera matrices rather than a velocity texture.
  • Motion Blur uses the same depth and velocity attachments for directional shutter blur.