Log inGet started
Package

AirClock.component

Newest version

README.md

AirClock

The one thing that drives the air in The House Wears a Face. One instance, on the Air group, execution order −105 so it settles the weather before anything reads it.

Everything the air slice does over the hundred seconds is a pure function of one number, the second of the film: the storm's four strikes, the height fog thickening, the three raymarched shafts brightening and dimming, which rain is falling and at what rate, the water column, the dust, and the wetness ramp that turns the ballroom floor from grey dust into a black mirror. Because it is a pure function of t, two takes of the same second draw the same air.

Where the second comes from

The cutscene. While demo.film is playing, the air is drawn at cutscene.status().time — not at a clock of its own, and not at accumulated dt. The storm therefore cannot drift away from the cut by a frame however the frame rate moves, and it is the same number whether the film is running in edit or in play.

When no film is playing, the air is held at previewT, so a slice capturing the room between takes sees a settled second rather than a film running away from it. A second clock, driftT, keeps running there and is what the shaft dust turns on, so the air is still alive to author against.

Fields

fieldwhat it is
previewTthe second the air is held at while no film is playing
gainmaster gain on everything this drives — 0 takes the weather off without deleting it, which is how a slice checks its own work against a clean frame

Methods

  • ref:seek(t) — move the air to an explicit second and settle it there. Every shot beat calls this, so a capture taken between takes settles at the shot the beat names. During a take the film's own clock wins on the next frame.
  • ref:filmTime() — the second the air is currently drawn at. During a take this equals cutscene.status().time exactly.
  • ref:lightningAt(t) — how bright the lightning is at a given second, for anything that has to agree with it: a thunder cue, an exposure allowed to be late.
  • ref:resetFilm() — back to zero, forgetting every pushed value so the next frame states the whole air again. demo.air.reset() calls it before a take.

The strikes

Four, at 4.5, 10.2, 39.4 and 74.8 seconds, at powers 1.00 / 0.72 / 0.55 / 0.85. Each is three flashes inside a third of a second over an afterglow the cloud keeps for about a second and a half. The pulse WIDTHS are read off the delivered film rather than off the curve: a film frame is a fortieth of a second, so a pulse narrower than that is a strike a frame either lands on or misses entirely, and the take that misses it has no lightning in it at all.

The flash drives a distant light — a parallel row beside the scene's own sun, so it lands on everything at once without displacing the sun — and it also raises the fog's inscatter and the volumetric medium's sun term, which is what puts the strike in the air rather than only on the surfaces.

Two hazards this component is shaped around

The shafts are driven through a per-instance lane, not through their material. AssetRef:setProperty in edit mode writes through to the asset on disk, coalescing to one asset write every 250 ms, so driving three shafts from the film clock that way rewrites three mat.yaml files four times a second and leaves their authored resting values at the mercy of whichever frame closed the window. renderer.instanceData.set(entity, 0, flow, gain, 0, 0) reaches the same shader and touches no asset. Lane 0 is x = the clock the dust drifts on, y = added to the material's resting brightness.

demo.constants is resolved lazily. It is a world module, and at engine boot this component's chunk can run before that module is resolvable: require raises once, the chunk dies with it, and the component then has no hooks at all for the rest of the session while the log carries a single line from start-up.

Hooks

update runs in edit mode as well as in play (OrigoZero/zero#2743 — the documented "play mode only" contract does not hold) and editorUpdate runs only in edit, so each hook takes the mode that is not the other's. That is one tick a frame whichever way that behaviour lands, and no wall clock is read to decide it.