Engine API Reference - v2.24.0-beta.10
    Preparing search index...

    Class CameraFrame

    Implementation of a simple to use camera rendering pass, which supports SSAO, Bloom and other rendering effects.

    Overriding compose shader chunks: The final compose pass registers its shader chunks in a way that does not override any chunks that were already provided. To customize the compose pass output, set your shader chunks on the ShaderChunks map before creating the CameraFrame. Those chunks will be picked up by the compose pass and preserved.

    Example (GLSL):

    // Provide custom compose chunk(s) before constructing CameraFrame
    ShaderChunks.get(graphicsDevice, SHADERLANGUAGE_GLSL).set('composeVignettePS', `
    vec3 applyVignette(vec3 color, vec2 uv) {
    return color * uv.x;
    }
    `);

    // For WebGPU, use SHADERLANGUAGE_WGSL instead.
    Index

    The bloom effect, registered with this camera frame. Its parameters are assigned directly.

    colorEnhance: ColorEnhanceEffect

    The color enhancement effect, registered with this camera frame. Its parameters are assigned directly.

    colorLUT: ColorLutEffect

    The color lookup table (LUT) effect, registered with this camera frame. Its parameters are assigned directly.

    debug:
        | "depth"
        | string & {}
        | "scene"
        | "ssao"
        | "bloom"
        | "vignette"
        | "dofcoc"
        | "dofblur"
        | null = null

    Debug rendering, which displays an intermediate value of the frame in place of the composed result. This never changes what the frame renders - a mode whose value this frame does not generate simply displays nothing: 'depth' renders black when no effect has produced the scene depth, and the modes of a disabled effect are ignored. Set to null to disable.

    Besides the built-in modes, this accepts the name of a debug view provided by an effect registered with this camera frame, see CameraFrameEffect#debugViews.

    The depth of field effect, registered with this camera frame. Its parameters are assigned directly.

    effects: CameraFrameEffect[] = []

    The effects registered with this camera frame, in the order they are applied within their compose slot. The built-in effects are registered by the constructor; add your own with CameraFrame#addEffect. Treat the array as read-only; use the methods of the camera frame to change it.

    fringing: FringingEffect

    The fringing effect, registered with this camera frame. Its parameters are assigned directly.

    grading: GradingEffect

    The color grading effect, registered with this camera frame. Its parameters are assigned directly.

    rendering: Rendering = ...

    Rendering settings.

    The screen space ambient occlusion effect, registered with this camera frame. Its parameters are assigned directly.

    taa: Taa = ...

    Taa settings.

    vignette: VignetteEffect

    The vignette effect, registered with this camera frame. Its parameters are assigned directly.

    volumetricFog: VolumetricFogEffect

    The volumetric fog effect, registered with this camera frame. Its parameters are assigned directly.

    • Registers an effect with this camera frame. The effect is applied at the compose slot it declares, after any effect already registered to that slot, from the next call to CameraFrame#update. The effect stays owned by the caller: removing it or destroying the camera frame does not destroy it.

      Parameters

      Returns void

      const tint = new TintEffect(app.graphicsDevice);
      cameraFrame.addEffect(tint);
      cameraFrame.update();
    • Creates a frame pass for the camera frame. Override this method to utilize a custom frame pass, typically one that extends FramePassCameraFrame.

      Returns FramePassCameraFrame

      • The frame pass.
    • Registers an effect with this camera frame, applying it before another registered effect when both share a compose slot. The effect is applied from the next call to CameraFrame#update.

      Parameters

      Returns void

      // apply the tint before the built-in vignette, which also runs at COMPOSESLOT_LDR
      cameraFrame.insertEffectBefore(tint, 'vignette');
    • Returns whether a device is able to let the gaussian splats contribute to the scene depth, which the volumetric fog and the depth of field need in order to be bounded by the splats instead of drawing through them. Their contribution additionally has to be turned on using GSplatParams#sceneDepthWrite; this reports whether doing so can take effect, so that an application rendering gaussian splats can disable those effects on the devices which cannot respect them.

      This tests the device alone, and so can be called before any camera frame is created. Whether a particular one then renders the depth this way also depends on its own settings - multi-sampling and a camera not clearing the whole of its render target both rule it out - and a debug build warns, naming the reason, when the splats end up not contributing.

      Parameters

      Returns boolean

      True if the splats can contribute to the scene depth.