# Your First Scene

Build a scene step by step, check it with the validator, and render a frame and a loop.

You'll build a 6 second loop: a neon knot in a ring of chrome spheres, with a hook line. Each step is a valid scene you can render.

## Start Empty

Every field has a default, so an empty object is already a scene. It renders the default background with the default camera and light rig.

```json title="hello.json"
{}
```

```bash
motion-sdk validate hello.json --final
motion-sdk render hello.json -t 0 -o hello.png
```

## Add a Mesh

Nodes live in a map keyed by id. A node with a `mesh` draws a geometry with a material. `preset:<name>` uses a material preset without declaring it.

```json
{
  "nodes": {
    "knot": {
      "mesh": { "geometry": { "torus_knot": {} }, "material": "preset:neon" }
    }
  }
}
```

## Name a Material

Declare materials once and refer to them by id. Presets are a starting point: any field you set overrides the preset's value.

```json
{
  "materials": {
    "glow": { "preset": "neon", "color": "#ff2ec4", "emissive_intensity": 5 }
  },
  "nodes": {
    "knot": { "mesh": { "geometry": { "torus_knot": {} }, "material": "glow" } }
  }
}
```

## Light It and Frame It

Pick a light rig, add bloom so the neon glows, and set the camera.

```json
{
  "camera": { "position": [0, 1.2, 7], "fov": 38 },
  "lighting": { "rig": "neon_rim" },
  "post": { "bloom": 1.2, "tone_mapping": "agx" }
}
```

## Add Copies

Many copies of one mesh are one node with `instances`. This is a single draw call.

```json
{
  "nodes": {
    "orbiters": {
      "mesh": {
        "geometry": { "sphere": { "radius": 0.18 } },
        "material": "preset:chrome",
        "instances": { "ring": { "count": 24, "radius": 2.2 } }
      }
    }
  }
}
```

## Animate It

A timeline has tracks. Each track animates one property of one node with keyframes. Ending a full turn later makes the loop seamless.

```json
{
  "timeline": {
    "duration": 6,
    "loop": "loop",
    "tracks": {
      "spin": {
        "target": "knot",
        "property": "rotation",
        "keyframes": [
          { "t": 0, "value": [0, 0, 0], "easing": "linear" },
          { "t": 6, "value": [360, 720, 0] }
        ]
      }
    }
  }
}
```

## Export It

Name an export and pick a preset. The preset decides size, fps, format and safe area.

```json
{
  "exports": {
    "x_square": { "preset": "x_1x1", "captions": [{ "start": 0, "end": 3, "text": "One prompt." }] }
  }
}
```

```bash
motion-sdk render hello.json --export x_square --require-seamless
```

The finished scene is [`examples/viral-x-loop.json`](https://github.com/brainfish-ai/motion/blob/main/examples/viral-x-loop.json), with sparkles, a gradient background and more post effects.

## Next

  - [The Scene Document](/docs/concepts/scene-document): The shapes every part of the spec follows.
  - [Features](/docs/features): Every feature, with an example and its properties.
