# Post Effects

Bloom, mist, exposure, tone mapping, colour grading, depth of field, grain and vignette.

`post` is the lens and the grade. The defaults are tuned, so add effects only to get a look.

```json title="apps/docs/examples/post.json"
{
  "camera": { "position": [0, 0.6, 6], "target": [0, 0.3, 0], "fov": 24 },
  "lighting": { "rig": "neon_rim" },
  "environment": { "background": { "solid": "#06050a" } },
  "post": {
    "bloom": 1.2,
    "bloom_radius": 0.7,
    "mist": 0.25,
    "tone_mapping": "agx",
    "exposure": 0.3,
    "grade": {
      "contrast": 1.1,
      "saturation": 1.15,
      "temperature": 0.2,
      "shadows": "#1a3050",
      "highlights": "#ffb070",
      "split": 0.3
    },
    "dof": { "focus": "hero", "aperture": 1.8 },
    "grain": 0.08,
    "vignette": 0.35,
    "chromatic_aberration": 0.15
  },
  "materials": {
    "neon": { "preset": "neon", "color": "#ff2ec4", "emissive_intensity": 6 },
    "cyan": { "preset": "neon", "color": "#00e5ff", "emissive_intensity": 5 }
  },
  "nodes": {
    "hero": {
      "mesh": {
        "geometry": { "torus": { "radius": 0.8, "tube": 0.08 } },
        "material": "neon"
      }
    },
    "far": {
      "transform": { "position": [2, 0.5, -6] },
      "mesh": {
        "geometry": { "torus": { "radius": 0.8, "tube": 0.08 } },
        "material": "cyan"
      }
    },
    "near": {
      "transform": { "position": [-0.9, -0.2, 2.5] },
      "mesh": {
        "geometry": { "sphere": { "radius": 0.2 } },
        "material": "cyan"
      }
    }
  }
}
```

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

## Glow

- `bloom`: strength (0.4 by default).
- `bloom_threshold`: the HDR brightness that starts glowing (1.2).
- `bloom_radius`: 0 is a tight halo, 1 a wide haze.
- `mist`: a soft, wide haze around everything bright. 0.2 to 0.4 is plenty.

## Exposure and Tone Mapping

`exposure` is in stops: +1 doubles the light. `tone_mapping` maps HDR to the screen: `neutral` (default, keeps brand colours exact), `aces` (filmic), `agx` (graceful on neon) or `none`.

## Grade

`grade` sets `contrast`, `saturation`, `temperature` (+ is warmer), `tint`, and split-tones `shadows` and `highlights` colours with `split`.

## Depth of Field

`dof: {"focus": "hero", "aperture": 1.8}` keeps a node sharp and blurs what's nearer or farther. Use `distance` in metres instead of a node. `max_blur` caps the blur as a fraction of frame height. It's physical, so wide shots stay mostly sharp: pair it with a long lens (fov 15 to 30).

`range` keeps a band of depth around the focus fully sharp. With an orthographic (2D) camera the blur is the plain depth gap, so blur a background by pushing it back: focus on the drawing, set `range` to cover its layers (a drawing's layers stack up to 10 units toward the camera), and move the background group back with `transform.position` z.

## Finishing

`grain`, `vignette` and `chromatic_aberration` finish the image. `msaa` sets antialiasing samples. `color_management: "legacy"` reproduces old three.js colour handling.

## API Reference

### PostFx

Post-processing. Defaults are subtle and cinematic.

| Property | Type | Default | Description |
| --- | --- | --- | --- |
| `bloom` | `number (0 to 2)` | `0.4` | Glow around emissive/bright areas, 0..2. |
| `bloom_radius` | `number (0 to 1)` | — | How far bloom spreads: 0 is a tight halo, 1 a wide haze (default 0.5). Neon tubes look best around 0.6-0.8. |
| `bloom_threshold` | `number (0 to 16)` | — | Linear brightness above which pixels bloom (default 1.2: only emissives and hot highlights). Lower it for a dreamier glow. |
| `chromatic_aberration` | `number (0 to 1)` | `0` | Chromatic aberration, 0..1. |
| `color_management` | `ColorManagement` | `"linear"` | `linear` (default): colors are sRGB and lighting is done in linear light. `legacy`: colors are used as-is and output without decoding, like three.js before r152 (washed-out, flat look); pair with `"tone_mapping": "none"` to match it. |
| `dof` | `Dof` | — | Depth of field from a physical lens (36x24 mm sensor). |
| `exposure` | `number (-8 to 8)` | — | Exposure in stops applied to the scene before tone mapping (the background colour is left exact). |
| `grade` | `Grade` | — | Colour grade after tone mapping. |
| `grain` | `number (0 to 1)` | `0` | Deterministic film grain (seeded), 0..1. |
| `mist` | `number (0 to 1)` | — | Diffusion-filter mist, 0..1: a soft glow of the whole image that lifts shadows and haloes lights (painterly, dreamy). |
| `msaa` | `integer (0 to 255)` | `4` | Multisample anti-aliasing sample count (1, 2, 4 or 8). |
| `pixel_art` | `PixelArt` | — | Pixel-art look: low-resolution rendering drawn as crisp squares, with palette snapping, ordered dither and outlines. |
| `rays` | `Rays` | — | Light shafts (god rays) from a point on screen. |
| `stylise` | `Stylise` | — | Hand-drawn look: hatching, ink outlines, paper, halftone, posterize and line boil, applied to the whole frame. |
| `tone_mapping` | `ToneMapping` | `"neutral"` | How HDR colour is mapped to the screen. |
| `vignette` | `number (0 to 1)` | `0.2` | Edge darkening, 0..1. |
### ToneMapping

| Value | Description |
| --- | --- |
| `"none"` | No tone mapping (values above 1 clip). |
| `"neutral"` | Khronos PBR Neutral: leaves colors below ~0.76 untouched so brand and UI colors render exactly, and only rolls off highlights (default). |
| `"aces"` | ACES filmic (contrasty, saturated highlights shift). |
| `"agx"` | AgX: filmic with graceful desaturation of very bright colors (neon). |
### ColorManagement

| Value | Description |
| --- | --- |
| `"linear"` |  |
| `"legacy"` |  |
### Grade

A colour grade, applied after tone mapping.

| Property | Type | Default | Description |
| --- | --- | --- | --- |
| `contrast` | `number (0.5 to 2)` | `1` | Contrast around mid grey, 0.5..2 (1 = unchanged). |
| `highlights` | `Color` | — | Split toning: the hue pushed into the highlights (e.g. orange). |
| `saturation` | `number (0 to 2)` | `1` | 0 is greyscale, 1 unchanged, 2 vivid. |
| `shadows` | `Color` | — | Split toning: the hue pushed into the shadows (e.g. teal). |
| `split` | `number (0 to 1)` | `0.3` | Strength of the split toning, 0..1. |
| `temperature` | `number (-1 to 1)` | `0` | White balance: -1 cool (blue) .. 1 warm (orange). |
| `tint` | `number (-1 to 1)` | `0` | -1 green .. 1 magenta. |
### Dof

Depth of field. Blur grows with distance from the focus plane, with a longer lens (narrower `fov`) and a wider aperture (smaller f-number).

| Property | Type | Default | Description |
| --- | --- | --- | --- |
| `aperture` | `number (0.5 to 32)` | `2.8` | Aperture as an f-number: 1.4 is very shallow, 2.8 cinematic, 8 deep. |
| `distance` | `number (≥ 0.01)` | `10` | Focus distance from the camera in world units (metres). |
| `focus` | `string` | — | Keep this node in focus (follows it as it moves). Overrides `distance`. |
| `max_blur` | `number (0 to 0.05)` | `0.015` | Largest blur radius as a fraction of the frame height. |
| `range` | `number (≥ 0)` | — | Depth around the focus that stays fully sharp, in world units. For 2D (orthographic) scenes: a drawing's layers stack up to 10 units toward the camera, so focus on the drawing with a `range` that covers it and push the background back (`transform.position` z) to blur it. |
