Gessa Docs
Recipes

Recipe

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

  1. Sun: attach a directional LightComponent { "type":"LightComponent", "mode":"directional", "color":"#fff2e0", "intensity": 3, "castShadow": true }. mode is one of directional, point, spot, area_rect, area_disc, ambient. Point the sun by rotating the entity's TransformComponent.
  2. Fill: add a second entity with an ambient LightComponent { "type":"LightComponent", "mode":"ambient", "color":"#8090b0", "intensity": 0.4 } so shadows are not pure black.
  3. Effect lights: point/spot lights use distance, decay, angleDeg (1..180 for spot cone), penumbra; flicker/pulse via modulation { "mode":"flicker", "rateHz": 6, "depth": 0.4, "seed": 1 } (modes none, strobe, pulse, flicker, disco).
  4. Mood zones: attach LocalEnvironmentVolumeComponent to 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 at blendDistance.
  5. 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.
  6. Day-night: the world environment carries an authored EnvState seed (simTimeSeconds in [0,86400), timeOfDayRate game-hours per real second; 0 is static). A moving sun is that rate plus, if you want scripted control, a TimerComponent firing a handler that patches the sun LightComponent.

Pitfalls

  • Every color is #rrggbb/#rrggbbaa; intensity, distance, decay are >= 0. angleDeg is 1..180.
  • Only ENABLED LocalEnvironmentVolumeComponents apply, and equal-priority overlaps resolve deterministically by entity id (warned). Give the dominant zone a higher priority.
  • LocalEnvironmentVolumeComponent only overrides the fields whose override* flag is true; setting fogDensity without overrideFog: true does 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_schema on LightComponent and LocalEnvironmentVolumeComponent.
  • qa_capture_renderer_viewport to confirm the sun, shadows, and fog read.
Was this helpful?Report an issueContact support

On this page