Skip to content

Scene ​

Some settings live on the scene rather than on a single object: the skybox, fog, gravity, image-based lighting, and the post-processing stack. They are stored on a singleton entity so you can read and mutate them from any Behaviour.

In the editor you set all of these in World Config: click the globe button in the inspector's header, or click empty space in the viewport. See World Config.

PageWhat it covers
EnvironmentSkybox (gradient / color / image / 360° panorama), fog (linear / exponential), physics gravity, and HDRI lighting with tone mapping and exposure.
PostprocessingBloom, vignette, depth-of-field, tone mapping, and other full-screen effects.

Pattern ​

Both components expose a convenience method on world, no manual entity lookup needed:

ts
import { Behaviour } from "@relu-interactives/spatial-ecs";

export default class TweakScene extends Behaviour {
  init() {
    const env = this.world.getEnvironmentComponent();
    if (!env) return;

    // Mutate `env.values` — sync systems pick the change up next frame.
    env.values.fog.type = "linear";
    env.values.fog.color = "#88aaff";
    env.values.fog.linear.near = 5;
    env.values.fog.linear.far = 60;
  }
}

The same pattern works for Postprocessing via this.world.getPostprocessingComponent(), see each page for the full set of authorable values.