# The Scene Document

The few shapes every part of the spec follows, so an agent writes it right the first time.

A scene is one JSON document. Its shapes are small and predictable on purpose: a model should be able to write any part of it correctly in few tokens.

## Everything Is Optional

Every field has a default, so `{}` is a valid scene and every partial scene renders. Write only what differs from the defaults.

## Maps Keyed by Id

Nodes, materials, textures, tracks, clips, states, paths, signals, prefabs and exports are maps keyed by id, never arrays. Ids use `[A-Za-z0-9_-]`.

```json
{
  "materials": { "paint": { "preset": "glossy_plastic", "color": "#f2c230" } },
  "nodes": {
    "car": { "mesh": { "geometry": { "box": { "size": [2, 0.9, 4.2] } }, "material": "paint" } },
    "cab": { "parent": "car", "transform": { "position": [0, 0.8, 0.3] } }
  }
}
```

Ids make patches stable: `/nodes/car/transform/position` means the same thing however many nodes you add, and the renderer updates one instance slot instead of rebuilding the scene.

## Hierarchy with `parent`

A node's `parent` is another node's id. Transforms are relative to the parent. A node with no `mesh`, `text` or `particles` is a group. A node has at most one of those three.

## Single-Key Variants

When a value can take several forms, it's an object with one key naming the form:

```json
{ "sphere": { "radius": 1 } }
{ "point": { "position": [0, 3, 0], "intensity": 40 } }
{ "click": { "node": "button" } }
```

Forms with no settings are plain strings: `"transparent"`, `"clip_end"`, `"linear"`.

## Units

| Quantity | Unit |
| --- | --- |
| Positions and sizes | World units. Treat them as metres. |
| Rotations | Euler degrees `[x, y, z]`, applied X, then Y, then Z |
| Times | Seconds |
| Colours | sRGB hex: `#rgb`, `#rrggbb` or `#rrggbbaa` |
| Field of view | Vertical degrees, or `focal_length` in mm on shots |

The camera looks down -z by default. +y is up. Imported glTF models face +z; nodes that `follow` a path face along -z.

## Top-Level Keys

| Key | What it holds |
| --- | --- |
| `version`, `meta`, `seed` | Spec version, title and description, and the seed for every random choice |
| `canvas` | Size and fps |
| `camera`, `shots` | The default camera, or a shot list with cuts |
| `environment`, `lighting`, `post` | Background and fog, lights and shadows, post effects |
| `materials`, `textures` | Named materials and images |
| `nodes`, `prefabs` | The scene graph, and templates for repeated parts |
| `paths`, `signals` | Curves that nodes follow, and cycling signals like traffic lights |
| `timeline`, `clips`, `state_machines` | Animation, and interactive states |
| `physics` | World settings for rigid bodies |
| `exports` | Named export targets |

Every key and property is listed in the [Scene reference](/docs/reference/scene).
