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.
At a Glance​
| Property | Value |
|---|---|
| Export | persistence |
| Shader uniform namespace | persistence |
| Backends | WebGPU and WebGL2 |
| Render passes | One accumulation pass and one history read per frame |
| History | Renderer-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:
| Behavior | Value | Purpose |
|---|---|---|
| Current-frame color boost | 4 | Keeps sparse bright samples visible in the accumulated image. |
| Previous-color contribution | 0.9 | Produces gradually decaying trails. |
| Previous-alpha decay | 0.9 | Preserves coverage while reducing stale history over time. |
| Output RGB range | Clamped to 1 | Prevents 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.
Related 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.