Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit098ece8e9e

README.md

atmo_scene_light

The air of the atmosphere as the scene stands in it. A point of the air takes the sun's single scattering only where nothing in the scene shadows it from the sun, read from the sun's shadow map the surfaces are shadowed by (zero::sun_shadow), and the sky's multiple scattering only as far as it sees the sky, read from the sky-visibility field (zero::sky_visibility). The air of a sealed room scatters no light at noon, and a gap in a wall throws a lit shaft through the haze behind it.

  • scene_air_sun(p, eye) / scene_air_sky(p): the share of the sun and the share of the sky the world point p sees. The sun's share is read from the pages a frame keeps for the air a camera at eye looks through (zero_sun_visibility_seen_from), whose texel is fine enough that air under a thin roof or behind a thin wall reads its own side.
  • integrate_segment_seen(pos, dir, sun_dir, t_start, t_end, steps, eye, upk): integrate_segment with every step lit by the sun its world point sees, and the stretch by the sky its middle sees (the field's cells are no finer than a stretch). eye is the world position the planet-space pos stands for and upk the world units in a kilometre.

Included with #include "@builtin::systems.atmosphere.atmo_scene_light" after atmo_common, atmo_transmittance_lookup, atmo_multiscatter_lookup and atmo_integrator, by the aerial perspective's volume (atmo_aerial) and its composite (atmo_composite). The including shader binds:

  - { name: sun_shadow, kind: buffer, access: read, element: ZeroVsmUniform, array: false }
  - { name: lights, kind: buffer, access: read, element: vec4<f32> }
  - { name: shadow_pool, kind: texture_depth }
  - { name: zero_environment, kind: buffer, access: read, element: ZeroEnvironment, array: false }
inputs = {
    sun_shadow = "@scene.sunShadow", lights = "@scene.lights",
    shadow_pool = "@scene.shadowPool", zero_environment = "@scene.reflectionProbes",
}

A point the sun's map holds no page for, and a scene with no sky-visibility field, read as seeing the sun and the sky.