# VolumetricFog

Interface · category: Other

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

Properties related to volumetric fog, a raymarched height fog lit by a directional light. The
fog samples the light's cascaded shadow map along each view ray, forming visible shafts of
light. The raymarch runs at a reduced resolution and is blended into the scene before TAA, so
when TAA is enabled, its noise is temporally resolved to a smooth result. Optionally the
clustered omni and spot lights scatter light in the fog as well, see `localOmniLights` and
`localSpotLights`.

## Properties

### ambientColor

```ts
ambientColor: Color
```

The color of the ambient in-scattered light, which keeps the
fog in shadowed areas visible. Defaults to white.

### ambientIntensity

```ts
ambientIntensity: number
```

The intensity of the ambient in-scattered light. Defaults
to 0.02.

### anisotropy

```ts
anisotropy: number
```

The anisotropy of the scattering, 0-0.95 range. Larger values
scatter more light forward, making the fog brighter when looking towards the light. Defaults
to 0.6.

### density

```ts
density: number
```

The fog density at the base height. Defaults to 0.01.

### enabled

```ts
enabled: boolean
```

Whether the volumetric fog is enabled. Defaults to false.

### extinction

```ts
extinction: number
```

A scale of how quickly the fog absorbs the light passing through
it, without affecting how much light it scatters. A value of 1 is physically consistent, where the
fog absorbs as much as it scatters, and distant fog and light shafts fade out exponentially with
the density. Lower values keep them visible over a longer distance while the fog itself stays as
bright, which is not physically correct but is often preferable. Defaults to 1.

### heightBase

```ts
heightBase: number
```

The world space height at which the fog density starts to fall
off. Below it the density is constant. Defaults to 0.

### heightFalloff

```ts
heightFalloff: number
```

The exponential falloff of the fog density with height above
the base height. Value of 0 makes the fog uniform. Defaults to 0.05.

### intensity

```ts
intensity: number
```

The intensity of the light scattering. Defaults to 1.

### light

```ts
light: LightComponent | null
```

The directional light providing the scattered light, or
null when the fog is lit by the local lights and the ambient term only. When a light of a type
other than directional is assigned, the effect is disabled. Defaults to null.

### localIntensity

```ts
localIntensity: number
```

The intensity of the light scattering of the local lights.
Defaults to 1.

### localOmniLights

```ts
localOmniLights: boolean
```

Whether the clustered omni lights scatter light in the fog.
Each light adds a raymarch over the part of the view rays inside its volume, sampling the shadow
and the cookie atlas of the clustered lighting, and so the cost scales with the screen space size
of the light volumes. As an omni light fills its whole bounding sphere, its volume is typically
much larger on the screen than the volume of a spot light. Requires clustered lighting, which is
enabled by default. Individual lights can scatter more or less light using
[LightComponent#volumetricScattering](https://api.playcanvas.com/engine/classes/LightComponent.md#volumetricscattering). Defaults to false.

### localSpotLights

```ts
localSpotLights: boolean
```

Whether the clustered spot lights scatter light in the fog,
forming visible beams. See `localOmniLights` for details, both types are rendered the same way and
share the `localIntensity` and `localSteps` settings. Defaults to false.

### localSteps

```ts
localSteps: number
```

The number of raymarching steps taken inside the volume of each
local light, 2-64 range. Defaults to 12.

### maxDistance

```ts
maxDistance: number
```

The maximum world space distance the fog is raymarched to.
Defaults to 300.

### scale

```ts
scale: number
```

The resolution scale of the fog texture relative to the scene
render target, 0.25-1 range. Defaults to 0.5.

### steps

```ts
steps: number
```

The number of raymarching steps, 4-128 range. Higher values improve
the quality at a higher performance cost. Defaults to 24.

### tint

```ts
tint: Color
```

The albedo of the fog. Defaults to white.
