Engine API Reference - v2.22.0-beta.18
    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', `
    #ifdef VIGNETTE
    vec3 applyVignette(vec3 color, vec2 uv) {
    return color * uv.u;
    }
    #endif
    `);

    // For WebGPU, use SHADERLANGUAGE_WGSL instead.
    Index
    bloom: Bloom = ...

    Bloom settings.

    colorEnhance: ColorEnhance = ...

    Color enhancement settings.

    colorLUT: ColorLUT = ...

    Color LUT settings.

    debug:
        | "depth"
        | "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.

    dof: Dof = ...

    DoF settings.

    fringing: Fringing = ...

    Fringing settings.

    grading: Grading = ...

    Grading settings.

    rendering: Rendering = ...

    Rendering settings.

    ssao: Ssao = ...

    SSAO settings.

    taa: Taa = ...

    Taa settings.

    vignette: Vignette = ...

    Vignette settings.

    volumetricFog: VolumetricFog = ...

    Volumetric fog settings.

    • get enabled(): boolean

      Gets the enabled state of the camera frame.

      Returns boolean

    • set enabled(value: boolean): void

      Sets the enabled state of the camera frame. Passing false will release associated resources.

      Parameters

      • value: boolean

      Returns void

    • 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.
    • Destroys the camera frame, removing all render passes.

      Returns void

    • Applies any changes made to the properties of this instance.

      Returns void

    • 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.