API

Class SnapshotRenderingHelper

A helper class to simplify work with FAST snapshot mode (WebGPU only - can be used in WebGL too, but won't do anything).

Index
showDebugLogs: boolean = false

Indicates if debug logs should be displayed

  • Disable snapshot rendering Note that this method is ref-counted and works in pair with enableSnapshotRendering(): you should call enableSnapshotRendering() as many times as you call disableSnapshotRendering().

    Parameters

    • OptionaldebugMessage: string

      An optional message to display in debug logs to help identify the context of the call to disableSnapshotRendering

    Returns void

  • Enable snapshot rendering Use this method instead of engine.snapshotRendering=true, to make sure everything is ready before enabling snapshot rendering. Note that this method is ref-counted and works in pair with disableSnapshotRendering(): you should call enableSnapshotRendering() as many times as you call disableSnapshotRendering().

    Parameters

    • OptionaldebugMessage: string

      An optional message to display in debug logs to help identify the context of the call to enableSnapshotRendering

    Returns void

  • Fix meshes for snapshot rendering. This method will make sure that some features are disabled or fixed to make sure snapshot rendering works correctly.

    Parameters

    • Optionalmeshes: AbstractMesh[]

      List of meshes to fix. If not provided, all meshes in the scene will be fixed.

    Returns void

  • Make a CPU particle system compatible with FAST snapshot rendering. The particle system will always render at full capacity (getCapacity() quads), with inactive slots collapsed to degenerate triangles via zero-fill. This keeps the recorded GPU bundle's draw call valid every frame, while the live particle data is uploaded to the bundle-referenced vertex buffer through the normal animate() path.

    The helper additionally advances the particle simulation and updates view/projection (and eyePosition/invView for billboard modes) into the particle system's draw wrappers each frame, because FAST snapshot replay skips the normal scene particle evaluation path after the bundle is recorded.

    Notes:

    • Call this BEFORE enableSnapshotRendering() so the recording sees the correct draw count.
    • GPU particle systems (GPUParticleSystem) are not supported by this method.
    • Vertex shader cost scales with getCapacity() rather than the live particle count, so size capacity realistically.
    • Per-frame uniforms other than camera matrices (e.g. textureMask, translationPivot, clip planes, fog) are baked at recording time and will not update during snapshot replay.

    Parameters

    • particleSystem: IParticleSystem

      The particle system to fix

    Returns void

  • Call this method to update a mesh on the GPU after some properties have changed (position, rotation, scaling). Note: in FAST snapshot mode the GPU bundle is recorded once and replayed every frame, so draw calls (including instance counts) are baked in. This method updates per-mesh GPU data such as transforms and mesh.visibility, but it cannot change whether a recorded draw call is emitted. To apply changes such as mesh.isVisible, setEnabled(false), or per-instance visibility/state changes that affect instance counts, wrap the change in a disableSnapshotRendering() / enableSnapshotRendering() pair so the snapshot is re-recorded.

    Parameters

    • mesh: any

      The mesh to update. Can be a single mesh or an array of meshes to update.

    • updateInstancedMeshes: boolean = true

      If true, the method will also update instanced meshes. Default is true. If you know instanced meshes won't move (or you don't have instanced meshes), you can set this to false to save some CPU time.

    Returns void

  • Update the meshes used in an effect layer to ensure that snapshot rendering works correctly for these meshes in this layer.

    Parameters

    • layer: any

      The effect layer or frame graph layer

    • autoUpdate: boolean = true

      If true, the helper will automatically update the meshes of the layer with each frame. If false, you'll need to call this method manually when the camera or layer meshes move or rotate.

    Returns void