Renderer · function

temporalDenoise

Blend this frame into the history a caller reprojected, and answer how much history there is.

Explained in Hello world.

function temporalDenoise(current: readonly [number, number, number] | Float32Array, history: readonly [number, number, number] | Float32Array, neighbourhood:
import { temporalDenoise } from '@driftengine/core';

Parameters

ParameterTypeDescription
currentreadonly [number, number, number] | Float32Array
historyreadonly [number, number, number] | Float32Array
neighbourhood{ readonly min: readonly [number, number, number]; readonly max: readonly [number, number, number]; } | null
disoccludedboolean
pixelTemporalPixel
outFloat32Array

In depth

history is where this pixel was last frame, already reprojected — this module does not do that and is not the place for it. disoccluded says the reprojection landed on something that is no longer there; neighbourhood, when supplied, is the box of colours actually around this pixel this frame, and the history is clipped into it by temporalAa.ts's own function.

A disocclusion resets rather than blends. It is not a stale history, it is a wrong one: a character stepping away from a wall uncovers pixels whose history is the character, and blending nine parts of that is a smear of them that follows them about. Resetting leaves one frame of noise, which the spatial pass has already reduced and which is gone by the next frame.