Recipes
Atmosphere sky lighting fog and time of day
The world needs a sun, sky, and mood. Lighting and local atmosphere are real AI-authorable components; the global sky preset and day-night rate live on the world environment.
engine v1.0.234since component-field-contract ecs.component-field-contract.v1, rendering.v1, action-catalog.v1.0.232Copy for LLM
Use this for
a sun and sky; ambient fill light; fog and mood zones; a day-night look; setting the overall world atmosphere
Not for
per-camera color grade and post (see camera-feel); water reflections (use WaterComponent)
Pairs with: Camera feel field of view smoothing tone mapping and post, Terrain basics ground heightmap and sculpting, Audio sound effects music and positional feedback
The recipe
- Sun: attach a directional
LightComponent{ "type":"LightComponent", "mode":"directional", "color":"#fff2e0", "intensity": 3, "castShadow": true }.modeis one ofdirectional,point,spot,area_rect,area_disc,ambient. Point the sun by rotating the entity'sTransformComponent. - Fill: add a second entity with an ambient
LightComponent{ "type":"LightComponent", "mode":"ambient", "color":"#8090b0", "intensity": 0.4 }so shadows are not pure black. - Effect lights:
point/spotlights usedistance,decay,angleDeg(1..180 for spot cone),penumbra; flicker/pulse viamodulation{ "mode":"flicker", "rateHz": 6, "depth": 0.4, "seed": 1 }(modesnone,strobe,pulse,flicker,disco). - Mood zones: attach
LocalEnvironmentVolumeComponentto a region entity{ "type":"LocalEnvironmentVolumeComponent", "enabled": true, "shape":"box", "overrideFog": true, "fogDensity": 0.3, "overrideAmbient": true, "ambientIntensity": 0.6, "overrideExposureCompensation": true, "exposureCompensationBias": -0.5, "priority": 1, "blendDistance": 4 }. It sparse-overrides the global environment inside its bounds and blends to the world default atblendDistance. - Global look: apply a renderer visual profile to the world with
world_apply_visual_profile(renderer.visual_profile.apply) for the sky preset, tone mapping, and post look shipped as a profile. - Day-night: the world environment carries an authored EnvState seed (
simTimeSecondsin [0,86400),timeOfDayRategame-hours per real second; 0 is static). A moving sun is that rate plus, if you want scripted control, aTimerComponentfiring a handler that patches the sunLightComponent.
Pitfalls
- Every
coloris#rrggbb/#rrggbbaa;intensity,distance,decayare>= 0.angleDegis 1..180. - Only ENABLED
LocalEnvironmentVolumeComponents apply, and equal-priority overlaps resolve deterministically by entity id (warned). Give the dominant zone a higherpriority. LocalEnvironmentVolumeComponentonly overrides the fields whoseoverride*flag is true; settingfogDensitywithoutoverrideFog: truedoes nothing.- There is no SkyComponent atomic; global sky is world environment plus a visual profile, not a component you attach to an entity.
Verify
engine_get_component_schemaonLightComponentandLocalEnvironmentVolumeComponent.qa_capture_renderer_viewportto confirm the sun, shadows, and fog read.