Skip to main content

Persistence

Accumulate the current frame into a fading history texture to create luminous motion trails and long-exposure visualizations. persistence owns its history texture and exposes explicit reset controls.

GitHub
0.0s

At a Glance​

PropertyValue
Exportpersistence
Shader uniform namespacepersistence
BackendsWebGPU and WebGL2
Render passesOne accumulation pass and one history read per frame
HistoryRenderer-owned accumulation texture

Usage​

import {EffectRenderer} from '@luma.gl/engine/api';
import {persistence} from '@luma.gl/engine/effects';

const renderer = new EffectRenderer(device, {effects: [persistence]});
renderer.resize([width, height]);

const accumulatedTexture = renderer.render({sourceTexture: currentSceneTexture});

Call resetHistory() when a scene change invalidates the accumulated image.

Parameters​

The current implementation has no public scalar uniforms. Its visual response is defined by the following fixed shader behavior:

BehaviorValuePurpose
Current-frame color boost4Keeps sparse bright samples visible in the accumulated image.
Previous-color contribution0.9Produces gradually decaying trails.
Previous-alpha decay0.9Preserves coverage while reducing stale history over time.
Output RGB rangeClamped to 1Prevents repeated accumulation from exceeding display range.

Composition and Cost​

The accumulation pass combines the current image with retained history. A second pass copies the updated history into the color chain for downstream effects.

  • Motion Blur follows current per-pixel velocity instead of accumulating previous images.
  • Temporal Antialiasing validates history with scene depth and motion vectors.
  • Bloom can add stabilized photographic glow to bright accumulated trails.