# Guide: Building a 3D Scene

ChainRender scenes render 2D/3D visuals on-chain via **SceneIR** — declarative, analyzable, with an on-chain poster
floor and optional GPU enhancement. This guide walks the scene-building flow at a high level.

## The shape of a scene

A scene is data: primitives (SDF shapes, points), materials (surface appearance), optional motion (TIME-driven
parameters), and optional interaction (INPUT → parameter). You compose it declaratively — no shader code, no
render loop — and it compiles to a content-addressed component like any other.

## Bind a scene component

```ts
import { compose } from "@chainrender/client";

// a scene renders as an image slot bound to a scene resolver (SDF / point cloud / etc.)
const scene = compose.image({
  bind: "sdfScene",           // the scene kind
  resolver: sdfSceneResolver, // a deployed scene resolver
  arg: encodedSceneArg,       // the scene's seed/parameters
  provenance: "computed",     // on-chain generated → Grade A
});
```

## The floor + enhancement model

- **Floor (always):** `renderFloor` produces a complete, bit-exact, on-chain SVG poster of the scene. This is what
  every viewer sees; it's Grade A and needs nothing but the chain.
- **Enhancement (optional):** a capable client can run the GPU ray-march / higher-detail version over the floor —
  and **fails closed to the floor** if it can't. See **[The Floor](../concepts/the-floor.md)**.

## Materials, motion, interaction

- **Materials** — describe a surface procedurally (color, roughness, pattern) as data, not a shader.
- **Motion** — declare a parameter as TIME-driven for animation (no script loop).
- **Interaction** — map an INPUT (a slider, a hover) to a parameter for bounded interactivity.
- **Skeleton** — pose/skin SDF forms via a skeletal rig, on-chain.

These are surveyed in **[Advanced Scenes, 3D & Effects](../concepts/advanced-scenes.md)**; use them when you need
genuine 3D/animated/interactive richness.

## Fullscreen

A scene can render in fullscreen presentation mode with adaptive resolution — higher detail at a larger viewport,
same on-chain floor.

## Related
- **[Advanced Scenes, 3D & Effects](../concepts/advanced-scenes.md)** · **[Rich Media: p5.js & three.js](../concepts/rich-media-p5-three.md)**
- **[Visual & Media Capabilities](../concepts/visual-media.md)**
