---
title: "Scene setup (asset type)"
description: "A scene setup configures a scene as a whole in one asset: its sun and ambient light, its fog, its render features and post effects…"
section: "Types"
slug: "types-scenesetup"
canonical: "https://origozero.ai/docs/types-scenesetup"
updated: "2026-12-01T12:03:59.356702484+00:00"
tags: ["asset-type", "reference"]
---

# Scene setup (asset type)

## Where it lives

- Source: `<name>.sceneSetup/`
- Identity: `<name>` (the `.sceneSetup` suffix strips from the identity)
- Folder shape:
  - `sceneSetup.yaml`: the definition. **Required.**
  - `README.md`: what the setup puts on a scene. **Required.**
  - `.metadata`: `description` and `tags`. **Required.**
  - `preview.png`: its picture. Optional.

## The definition

```yaml
members:
  - id: sun                                        # required, ^[a-z][A-Za-z0-9_]*$, unique
    source: "./sun.sceneLight"                     # any asset that implements applicable
  - id: ambient
    source: "./fill.sceneLight"
    values: { intensity: 0.12 }                    # values for the member's parameters
  - id: fog
    source: "<a fog render feature>"
    enabled: false                                 # optional, default true
  - id: grade
    source: "./grade.postEffect"
    values: { saturation: 0.82, contrast: 1.12 }
```

A member's `values` are the values this setup states for that member; the
member asset keeps its own, and another holder of it states its own.

### Values that follow the hour

A value can be stated for named hours instead of once, and the member
receives the value at the hour the scene's sky draws (`sky.getTimeOfDay()`),
blended between the keys either side of it (across midnight from the last key
to the first; a boolean or a name takes the latest key at or before the hour):

```yaml
  - id: ambient
    source: "./fill.sceneLight"
    values:
      intensity:
        byHour: { "05:00": 0.05, "07:30": 0.35, "16:30": 0.35, "19:30": 0.05 }
  - id: fog
    source: "<a fog render feature>"
    values:
      color:
        byHour: { "07:30": [0.62, 0.68, 0.78, 1], "19:30": [0.08, 0.1, 0.16, 1] }
```

A key is a number of hours from 0 to 24, a numeral or `"HH:MM"` (quoted, so
the YAML reads it as text). As the hour moves, by hand or with the sky's
`autoCycle`, every member holding such a value is applied again at the new
hour, a step for each game minute, on every client from the same hour. So the
ambient light, the fog, an exposure, a light's intensity or whether it is on
follow the sky with no script. While the sky's `autoCycle` runs, the hour it
draws is its `timeOfDay` plus the time the session has cycled, so set
`autoCycle` to `false` to hold an hour while you look at it, and read the hour
drawn with `sky.getTimeOfDay()`. `setup:get(path)` answers the value as stated
in `value` and the value at the hour now in `landed`; a placement's override
can be stated by hour the same way, and a relative override over a value
stated by hour scales or offsets every key.

A member that composes members of its own (a sky holding its `backdrop`) takes
values for them by path, and a path holds a slash, so it can key `values`
plainly (`backdrop/horizonColor:`). That is how the sky's own colours follow
the hour: the sky's dawn and dusk share one tint (`dawnHorizonColor`,
`dawnZenithColor`, leaned toward by `dawnStrength`), so a warm morning and an
orange evening that differ come from stating that tint, or the horizon and
zenith colours, by hour:

```yaml
  - id: sky
    source: "./sky.sky"
    values:
      backdrop/horizonColor:
        byHour: { "07:00": [1.0, 0.78, 0.55, 1], "12:00": [0.62, 0.74, 0.9, 1], "18:00": [1.0, 0.5, 0.2, 1] }
```
`@builtin::examples.lighting.example_day_and_night.example_day_and_night` is a
setup whose sky, sun, moonlight, ambient light and fog run from day to a
moonlit night this way.

A member's `source` is one of:

- an identity: `lighting.harbour_fill`, `@builtin::<library>.<name>`. It
  resolves among the assets that can be members, so a name another kind of
  asset also answers to reaches the member;
- a path with its type suffix: absolute (`/source/lighting/harbour_fill.sceneLight`),
  from the folder holding this setup (`harbour_fill.sceneLight`,
  `./harbour_fill.sceneLight`, `../shared/fill.sceneLight`), or from the
  world's source folder (`lighting/harbour_fill.sceneLight`). A path starting
  `./` or `../` is read from the setup's folder alone.

An identity drops the type suffix, so `harbour_dusk.sky` and
`harbour_dusk.sceneSetup` in one folder share `lighting.harbour_dusk`; a
member naming that identity is skipped as `sceneSetup.member.ambiguous`, which
names both assets, and its path names the one meant. A source that names
nothing is `sceneSetup.member.missing`, and its values and overrides are kept
until it resolves.

A member whose type does not implement `applicable` is refused by name
(`sceneSetup.member.unsupported`). A key the engine does not read is a warning.

## Parameters and paths

A setup's parameters are its members': `<member id>/<name>` (`fog/density`), a
nested member's under its path (`look/reflections/intensity`), and
`<member id>/@enabled` for every member. `@lit` (true by default) says whether
the scene renders lit; off, every surface shows its own colour with no light on
it, for a stylised game or a menu. `asset.schema(setupRef)` lists every path
with the member's own Field descriptor.

A setup that nests another names its parameters through the member id it
gives the nested setup: a setup whose member `base` is another setup has
`base/fog/density` for that setup's `fog/density`, and a placement sets
`base/fog/density`. A path that is no parameter is refused naming the paths
that end in it.

The value a member receives, for each parameter, first present wins: the
placement's override, the outermost setup's `values`, each inner setup's
`values`, the member asset's live value, then its saved value.

## Placing and tuning

```lua
-- A world's setup by its identity (`lighting/harbour_dusk.sceneSetup` is
-- `lighting.harbour_dusk`), or by its absolute path, `/source/lighting/harbour_dusk.sceneSetup`.
local root = asset.resolve("lighting.harbour_dusk", "sceneSetup"):instantiate(nil, { name = "lighting" })
local setup = root.component.get("SceneSetup")
setup:set("fog/density", 0.05)                -- this placement's override
setup:set("fog/density", { scale = 3.75 })    -- relative: the setup's density times 3.75
setup:set("fog/heightFalloff", { offset = -0.06 }) -- relative: the setup's value plus -0.06
setup:set("ao/@enabled", true)                -- turns a member on for this placement
setup:reset("fog/density")                    -- back to what the setup says
for path, m in pairs(setup:members()) do print(path, m.state.status) end
```

The placed root holds the `Asset` component (its `source` is the setup) and the
`SceneSetup` component (this placement's `overrides`); the scene stores nothing
of any member. Removing the `Asset` removes the `SceneSetup`, and every member's
application goes with it.

A relative override (`{ scale = n }` or `{ offset = n }`, numeric parameters
only) lands at the value the setup supplies times `scale` or plus `offset`,
checked against the parameter's descriptor, and follows that value: edit the
setup's fog density and every placement scaling it moves with it. It is saved
and synced like any override, and the Inspector shows it as relative.

**Where each value comes from.** `setup:get(path)` and each member's `values`
in `setup:members()` say it: `origin` is `override` (this placement's, with
`relative` and `supplied` for a relative one), `definition` (with `definedBy`,
the setup stating it, and `definedAt`, the path it states it at there, so a
value inherited through a nested setup names that setup), `live` (the member
asset's live value) or `saved`. One line proves what a placement shares:

```lua
for name, v in pairs(setup:members()["fog"].values) do print(name, v.value, v.origin, v.definedBy) end
```

**A light that follows the sky lands at what the sky makes of it.** A sun, a
fill or a rim that follows the sky (`followSky`) states its intensity as its
noon peak: the sky gives it that intensity with the sun 30° up or higher and
dims it toward the horizon, to about a third at 7° and 0 below it. So a dusk
sun stated at 3.2 at 17:51 lands near 0.4. `setup:get(path).landed` (and
`setup:set(path, value)`, which returns the same read) is what it lands at
now, beside `value`, what it states; the card shows `3.2 → lands at 0.4 at
17:51` on the row. The member's `state.notice` in `setup:members()` names a
light the sky dims to under a third of what it states, a distant fill that
lands brighter than the sun it is meant to support, and an ambient term at
half the sun or more. Raise
the stated intensity, move the hour, or, for a fill or a rim, set
`followSkyIntensity` to `false` so it keeps what it states.

**`set` in edit mode is a scene edit.** In edit mode on a world scene, a `set`
is an authored edit of the scene, recorded and saved: it holds over what
`build.luau` states until it is reset or released (`sceneAuthoring`
`releaseAuthored`). A `reset` that leaves the placement with no override
records nothing and releases the edit an earlier `set` recorded. Overrides
stated in `build.luau` are the build's own.

## Auditioning another setup

Two placements, or a placement and an application from code, each apply their
own sun, ambient term and fog; the effect decides which is in force (the
light-tie rule for lights), so an application beside a placed setup reports the
members another application holds as `held`, with `heldBy`, and its
`ApplyState.notice` names each held member, its asset and its holder. To see a
setup in place of the placed one:

- audition it on the placement, a preview for the session:
  `setup:audition(asset.resolve("lighting.harbour_night", "sceneSetup"))`
  applies it in the placed setup's place and records nothing;
  `setup:endAudition()` (or the card's End audition, a flip, a reload) puts
  the placement's own setup back. `set` and `reset` are refused while it lasts;
- apply it from code (below): it holds over the placement across flips until
  it is dropped;
- read its preview: `preview.png` lights the reference subject
  `@builtin::preview.subjects.lookdev` with the setup alone, its exposure fit
  so a night setup reads (below);
- point the placement's `Asset` source at it (a scene edit that stays;
  `releaseAuthored` returns the placement to `build.luau`'s setup);
- or apply it in a scene with no setup placed, such as a scratch scene.

## Applying it from code

A setup implements `applicable` itself, so it can be applied for an owner
like any member: `setupRef:as("applicable"):apply(owner, values)` starts an
application and `setupRef:as("applicable"):drop(owner)` ends it. Each member is
applied with the owner `"<owner>/<member id>"`.

- **It takes the effects that hold one at a time.** The scene's sun, its
  ambient term, its sky and each render feature's settings are held by one
  application at a time: of the applications standing, the newest to state
  something holds it, so an application made over a placed setup holds them
  while it stands, and the placement's members report `held` by it.
- **It stays in force until it is dropped,** across edit/play flips and device
  rebuilds.
- **Its drop hands every effect back** to the application before it: the
  placement's own, or the scene's own lights.

Which of two suns or two fogs is in force is the effect's own to decide; the
setup decides nothing about its members. An audition (above) is a preview for
the session that a flip ends; an application from code stands until it is dropped.

```lua
local night = asset.resolve("lighting.harbour_night", "sceneSetup")
night:as("applicable"):apply("myGame:time", {})   -- night holds over the placement
-- … flips, rebuilds …
night:as("applicable"):drop("myGame:time")       -- the placement's lighting is back
```

## Checking one

`asset.validate(setupRef)` (an engine API function) reads the definition and
every value and returns `{ ok, problems }`: each diagnostic (`sceneSetup.member.missing` and the rest) with its
code, severity, path and message. A problem of severity `error` refuses a push.

## Its picture

A setup's `preview.png` shows its own lighting on a fixed reference subject,
`@builtin::preview.subjects.lookdev` (a grey ground, a white diffuse sphere, a
chrome sphere and a grey card). The preview studio stands the subject and
applies the setup to the world with the owner `preview` for the shot, so its
sun, sky and effects are the ones in force, then drops it, which hands every
effect back to the scene's own holder. A frame that reads darker than mid
grey (a night setup) is shot with its exposure opened up for the picture
alone, by up to eight stops, so the night look reads without the setup
changing. For those frames the world shows the
setup's lighting, so the picture renders only on an explicit request
(`preview.writePreview`, `assets.generatePreviews`, staging) and never from
the preview queue or a live preview; the last picture stands otherwise.

## Make one

```lua
asset.create("sceneSetup", "dusk", { members = {
    { id = "sun", source = "./sun.sceneLight" },
    { id = "ambient", source = "./fill.sceneLight", values = { intensity = 0.1 } },
} })
```
