# Runtimes

The browser player, native rendering and headless export all share one renderer.

The same Rust renderer draws everywhere. What changes is how it gets frames to you.

## Browser

`@motion-sdk/core` loads the renderer as WebAssembly.

- **WebGPU** is the default when the browser can create an adapter.
- **WebGL2** is a separate bundle, fetched only when WebGPU isn't available.
- Each animation frame makes exactly one call into wasm. Input goes through shared memory and patches are batched.

There are three bundles:

| Bundle | Brotli budget | Loaded when |
| --- | --- | --- |
| WebGPU player | 300 kB | Plain scenes on WebGPU |
| WebGPU authoring | 420 kB | Scenes with `prefabs`, `repeat`, glTF models, rigid bodies, 2D shapes or SVG drawings, or `authoring: true` |
| WebGL2 fallback | 450 kB | No WebGPU. Always includes authoring. |

`createPlayer` picks the bundle from the first scene. Pass `{ authoring: true }` if you'll stream templates or models in later. To ship a templated scene on the lean player, flatten it first:

```bash
motion-sdk expand scene.json -o scene.player.json
```

## Native and Headless

`motion-sdk-render` runs on Vulkan, Metal or DX12, or a software driver like lavapipe. The CLI uses it to render PNG frames and, through `motion-sdk-export`, MP4, GIF and PNG sequences. CI renders every golden test this way, with no GPU.

```bash
motion-sdk render scene.json -t 1.5 -o frame.png
motion-sdk render scene.json --export x_square
```

## Which to Use

- An interactive embed or a live agent UI: the browser player.
- A video for X, TikTok or a slide: the CLI, or `motion-sdk-export` from Rust.
- A frame for an agent to check its own work: `motion-sdk render -t <seconds>`.
