Skip to content

Latest commit

 

History

History
8 lines (5 loc) · 2.08 KB

environment.md

File metadata and controls

8 lines (5 loc) · 2.08 KB

Environment Simulation and Rendering

EnvironmentSystem (joy-environment) is renderer-independent state for solar time, the sun and moon, skylight, wind, and authored environmental policy. A game owns it and advances it with elapsed seconds. A zero day length pauses solar time while wind continues; analytic wind never consumes gameplay randomness.

The resulting EnvironmentFrame supplies common state to rendering and gameplay. Directions use Y-up world coordinates, distances use world units, and colors are linear. The sun and moon are AtmosphereLights: a shared DirectionalLight (direction, color, intensity, source angular radius, and shadow casting, the same record a studio key light uses) plus the celestial body it represents, which only the sky needs. The skylight is a Skylight with a sky color overhead and a ground color below the horizon (the sky and sun light reflected by the ground), so surfaces facing down receive dimmer, warmer ambient than surfaces facing up. The skylight does not render a shadow map; it arrives from every direction, so its occlusion comes from material occlusion maps and the ambient occlusion scene effects. Keep simulation clocks independent from rendering cadence and avoid separately maintained sun or wind state in passes.

Sky presentation settings belong to the renderer: SkyOptions groups atmosphere scattering and fog, the cloud layer, light shafts, and ambient occlusion, with SkyOptions::validate for authored values. environment_lighting(&frame, &sky) (joy-scene) combines a frame with those settings into the EnvironmentLighting record passed in the renderer's FrameInputs. The atmosphere draws after opaque geometry on the far plane, so it shades only the pixels no surface covers, and participates in the same HDR/display pipeline. Lighting, fog, and optional scene effects consume frame data through their documented contracts; enabling policy in a document does not itself add a rendering pass.

See simulation, scene effects, and the joy-environment, joy-renderer, and joy-scene test suites.