# ColorEnhanceEffect

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

Source: https://github.com/playcanvas/engine/blob/64089771243fe28a9b9d2b4de538b99b07c75097/src/extras/effects/color-enhance/color-enhance-effect.js#L24

The color enhancement effect, a postprocessing technique that provides HDR-aware adjustments for
shadows, highlights, midtones, vibrance, and dehaze. Shadows and highlights allow selective
adjustment of dark and bright areas of the image, vibrance is a smart saturation that boosts
less-saturated colors more than already-saturated ones, and dehaze removes atmospheric haze to
increase clarity and contrast.

Applied in linear HDR space, before tone mapping and before the color grading.

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

## Constructors

### constructor

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

**Parameters**

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

## Properties

### dehaze

```ts
dehaze: number = 0
```

The dehaze adjustment, -1 to 1 range. Positive values remove atmospheric haze, increasing
clarity and contrast. Negative values add a haze effect. Defaults to 0.

### enabled

```ts
enabled: boolean = false
```

Whether color enhancement is enabled. Defaults to false.

### highlights

```ts
highlights: number = 0
```

The highlight adjustment, -3 to 3 range. Uses an exponential curve where -3 gives 0.125x, 0
gives 1x, and +3 gives 8x brightness on bright areas. Defaults to 0.

### midtones

```ts
midtones: number = 0
```

The midtone adjustment, -1 to 1 range. Positive values brighten midtones, negative values
darken midtones, with shadows and highlights more strongly preserved than by a linear
exposure change. Defaults to 0.

### shadows

```ts
shadows: number = 0
```

The shadow adjustment, -3 to 3 range. Uses an exponential curve where -3 gives 0.125x, 0
gives 1x, and +3 gives 8x brightness on dark areas. Defaults to 0.

### vibrance

```ts
vibrance: number = 0
```

The vibrance (smart saturation), -1 to 1 range. Positive values boost saturation of
less-saturated colors more than already-saturated ones. Negative values desaturate.
Defaults to 0.

## Methods

### 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`
- `get active(): boolean`
- `get cameraExposureScale(): number`
- `get chunkName(): string`
- `get debugViews(): string[]`
- `get defineName(): string`
- `get entryPoint(): string`
- `get glsl(): string | null`
- `get id(): string`
- `get requires(): string[]`
- `get slot(): string | null`
- `get wgsl(): string | null`
- `buildKey(): string`
- `createPasses(resources: CameraFrameEffectResources, passes: CameraFrameEffectPasses): void`
- `destroy(): void`
- `destroyPasses(): void`
- `frameUpdate(frame: CameraFrameEffectContext): 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`
