# BloomEffect

Class · extends [`CameraFrameEffect`](https://api.playcanvas.com/engine/classes/CameraFrameEffect.md) · category: Graphics

Source: https://github.com/playcanvas/engine/blob/64089771243fe28a9b9d2b4de538b99b07c75097/src/extras/effects/bloom/bloom-effect.js#L32

The HDR bloom effect, a postprocessing technique that simulates the natural glow of bright light
sources by spreading their intensity beyond their boundaries, creating a soft and realistic
blooming effect.

The bloom is generated from the scene by passes the effect owns, from a half resolution copy of
it or, with [BloomEffect#highQuality](https://api.playcanvas.com/engine/classes/BloomEffect.md#highquality), from the full resolution scene, and added to the
scene in linear HDR space, before tone mapping. It requires an HDR scene format, and is
disabled when the camera frame renders to [PIXELFORMAT_RGBA8](https://api.playcanvas.com/engine/variables/PIXELFORMAT_RGBA8.md).

Every [CameraFrame](https://api.playcanvas.com/engine/classes/CameraFrame.md) constructs and registers one, available as [CameraFrame#bloom](https://api.playcanvas.com/engine/classes/CameraFrame.md#bloom).

## Constructors

### constructor

```ts
new BloomEffect(device: GraphicsDevice)
```

**Parameters**

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

## Properties

### blurLevel

```ts
blurLevel: number = 16
```

The number of iterations for blurring the bloom effect, with each level doubling the blur
size. Once the blur size matches the dimensions of the render target, further blur passes are
skipped. Defaults to 16.

### highQuality

```ts
highQuality: boolean = false
```

Whether the bloom is generated from the full resolution scene instead of a half resolution
copy of it. This gives a sharper and more stable glow around small bright features, with a
slightly stronger core, at a higher performance cost. Defaults to false.

### intensity

```ts
intensity: number = 0
```

The intensity of the bloom effect, 0-0.1 range. Defaults to 0, making it disabled.

### threshold

```ts
threshold: number = 0
```

The brightness below which the scene does not contribute to bloom. Zero, the default, blooms
the whole scene, which is the physically based behavior; raising it restricts the glow to the
brightest parts, with a soft transition below the threshold. The value is in the
scene-referred units the scene is rendered in, before the exposure and tone mapping applied
when the bloom is composited, so a scene lit for an exposure far from 1 needs the threshold
scaled to match.

## Accessors

### active

```ts
get active(): boolean
```

Gets whether the effect contributes to the frame. A zero intensity disables it, the
intensity being the effect's on/off control, and so does a scene format without HDR range.

### requires

```ts
get requires(): string[]
```

Gets the frame resources the effect needs: the half resolution scene, unless
[BloomEffect#highQuality](https://api.playcanvas.com/engine/classes/BloomEffect.md#highquality) is set.

## Methods

### frameUpdate

```ts
frameUpdate(frame: CameraFrameEffectContext): void
```

**Parameters**

- `frame` ([`CameraFrameEffectContext`](https://api.playcanvas.com/engine/interfaces/CameraFrameEffectContext.md)): The values of this frame.

### update

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

Applies the effect's parameters. Called by [CameraFrame#update](https://api.playcanvas.com/engine/classes/CameraFrame.md#update) while the effect is
active: set the uniform values with [CameraFrameEffect#setUniform](https://api.playcanvas.com/engine/classes/CameraFrameEffect.md#setuniform) here, and the
defines which depend on the parameters.
Everything it sets is what the frames rendered until the next update use.

## Inherited from [CameraFrameEffect](https://api.playcanvas.com/engine/classes/CameraFrameEffect.md)

- `cameraFrame: CameraFrame | null = null`
- `device: GraphicsDevice`
- `enabled: boolean = true`
- `get cameraExposureScale(): number`
- `get chunkName(): string`
- `get debugViews(): string[]`
- `get defineName(): string`
- `get entryPoint(): string`
- `get glsl(): string | null`
- `get id(): string`
- `get slot(): string | null`
- `get wgsl(): string | null`
- `buildKey(): string`
- `destroy(): void`
- `getChunk(shaderLanguage: string): string | null`
- `resolveScene(scene: CameraFrameEffectScene): void`
- `setDefine(name: string, value: any): void`
- `setUniform(name: string, value: number | number[] | ArrayBufferView<ArrayBufferLike> | Texture): void`
