# CameraFrame

Class · category: Graphics

Source: https://github.com/playcanvas/engine/blob/f059dc005842f76e052cdf44d8370c8c7ec475ac/src/extras/render-passes/camera-frame.js#L300

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](https://api.playcanvas.com/engine/classes/ShaderChunks.md) map before creating the `CameraFrame`. Those chunks will be picked up by
the compose pass and preserved.

Example (GLSL):

**Example**

```ts
// 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.
```

## Constructors

### constructor

```ts
new CameraFrame(app: AppBase, cameraComponent: CameraComponent)
```

Creates a new CameraFrame instance.

**Parameters**

- `app` ([`AppBase`](https://api.playcanvas.com/engine/classes/AppBase.md)): The application.
- `cameraComponent` ([`CameraComponent`](https://api.playcanvas.com/engine/classes/CameraComponent.md)): The camera component.

## Properties

### bloom

```ts
bloom: Bloom
```

Bloom settings.

### colorEnhance

```ts
colorEnhance: ColorEnhance
```

Color enhancement settings.

### colorLUT

```ts
colorLUT: ColorLUT
```

Color LUT settings.

### debug

```ts
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

```ts
dof: Dof
```

DoF settings.

### fringing

```ts
fringing: Fringing
```

Fringing settings.

### grading

```ts
grading: Grading
```

Grading settings.

### rendering

```ts
rendering: Rendering
```

Rendering settings.

### ssao

```ts
ssao: Ssao
```

SSAO settings.

### taa

```ts
taa: Taa
```

Taa settings.

### vignette

```ts
vignette: Vignette
```

Vignette settings.

### volumetricFog

```ts
volumetricFog: VolumetricFog
```

Volumetric fog settings.

## Accessors

### enabled

```ts
get enabled(): boolean
set enabled(value: boolean)
```

Gets the enabled state of the camera frame.

## Methods

### createRenderPass

```ts
createRenderPass(): FramePassCameraFrame
```

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.

### destroy

```ts
destroy(): void
```

Destroys the camera frame, removing all render passes.

### update

```ts
update(): void
```

Applies any changes made to the properties of this instance.

### isSplatSceneDepthSupported

```ts
static isSplatSceneDepthSupported(device: GraphicsDevice): boolean
```

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](https://api.playcanvas.com/engine/classes/GSplatParams.md#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**

- `device` ([`GraphicsDevice`](https://api.playcanvas.com/engine/classes/GraphicsDevice.md)): The graphics device.

**Returns** `boolean`: True if the splats can contribute to the scene depth.
