# Fog

Distance fog that melts scenery into the sky, and scatters light into visible beams.

`environment.fog` fades distant geometry towards a colour. Leave the colour out and fog takes the sky's horizon colour, so the scene melts into the sky.

```json title="apps/docs/examples/fog.json"
{
  "camera": { "position": [0, 2, 12], "target": [0, 2, 0], "fov": 50 },
  "lighting": { "rig": "golden_hour" },
  "environment": {
    "background": {
      "sky": {
        "zenith": "#6f8fb8",
        "horizon": "#d8e2ec",
        "sun": null,
        "clouds": null
      }
    },
    "fog": { "density": 0.05 }
  },
  "materials": {
    "floor": { "preset": "matte_clay", "color": "#8a9a8a" },
    "pine": { "color": "#2f5a3e", "shading": "flat" }
  },
  "nodes": {
    "floor": {
      "mesh": {
        "geometry": { "plane": { "size": [200, 200] } },
        "material": "floor"
      },
      "transform": { "rotation": [-90, 0, 0] }
    },
    "trees": {
      "transform": { "position": [0, 1.6, -14] },
      "mesh": {
        "geometry": { "cone": { "radius": 0.9, "height": 3.2, "segments": 8 } },
        "material": "pine",
        "instances": {
          "grid": { "count": [9, 1, 8], "spacing": [4.5, 1, 4.5] }
        }
      }
    }
  }
}
```

![Render of fog](/renders/fog.jpg)

## Beams

`"fog": {"density": 0.012, "scatter": 1}` makes point and spot lights glow through the fog, and spots throw visible beams: night roads, snow, mist. See [Lights on Nodes](/docs/features/lighting#lights-on-nodes).

Native renders, the authoring bundle and the WebGL2 bundle draw scattering. The lean WebGPU player skips it to stay inside its size budget.

## API Reference

### Fog

Squared-exponential distance fog that starts at the camera's target distance: the subject stays crisp while the background and horizon fade into `color`.

| Property | Type | Default | Description |
| --- | --- | --- | --- |
| `color` | `Color` | — | Defaults to the background's horizon colour (the sky's `horizon`). |
| `density` (required) | `number (0 to 1)` | — | How thick the fog is. |
| `scatter` | `number (0 to 10)` | — | Light scattered by the fog: point and spot lights glow through it and spots show their beams (headlights in snow, torches in mist). 0 is off; 1 is a clear beam. Drawn by the authoring and WebGL bundles and native renders; the lean WebGPU player skips it. |
