Map 3D: the game's physical sky, light, haze and exposure from the timecycle (SIX-211) #286

Manually merged
github merged 11 commits from gh-pr/286/head into gh-pr/286/base 2026-11-26 20:24:40 +00:00
Owner

@⁠holdmysocks on GitHub · 2026-11-25 15:05 UTC · original
holdmysocks:six-map3d → master · +1844 −43 · 11 files · 11 commits · merged 2026-11-25 18:33 UTC

Part 1 of the Map 3D rebuild (SIX-211): the map renders an HDR frame lit by the game's own sky, from the timecycle. Builds on #276 (the timecycle table, merged).

What changes

  • Physical sky from the timecycle. The sky_new_* variables describe the atmosphere: planet radius, atmosphere top (Karman line), Rayleigh and Mie scattering with their scale heights, Mie absorption and phase eccentricity, and a two-piece ozone layer (its constants match the usual ozone profile exactly). atmo.wgsl renders it with look-up tables in compute passes: transmittance (256 × 64) and multiple scattering (32 × 32) when the medium changes, then per frame the sky seen from the camera (192 × 108), a 32³ froxel volume of aerial perspective (40 km deep near the ground, out past the horizon from higher up) and a 6-direction ambient cube. The sun's disc (sky_sun_disc_size), a full moon opposite it, stars (sky_stars_*) and the night air glow (sky_air_glow_*) are drawn on top.
  • Physical light on surfaces. The sun's illuminance (sky_scattering_sun_illuminance, ~100 000 lux) × light_dir_col × sky_scattering_sun_col × light_dir_sun_mult reaches each point through the air (transmittance table), so a low sun turns orange and fades; the moon likewise. The sky's light is the ambient cube, scaled by ambient_sky_intensity × indirect_light_sky_multiplier, plus sunlight bounced off lit surroundings (ambient_bounce_intensity × a 15 % ground albedo). Reflections read the sky table. The two height fog layers (local_atmosphere_fog_density/falloff/height, e.g. Misty, Fog) are applied per pixel.
  • HDR frame, exposure, post. Map 3D renders into RGBA16F. The exposure meter is three parts incident light at the camera (sun, moon and sky on a level grey card; a low sun counted as if 20° up) to one part a histogram of the frame between the timecycle's low and high percentiles; it moves to the key value at the timecycle's adaptation rate (postfx_exposure as an offset). Baked map tiles are lit at 60 % of their colour (they carry their own light). Then bloom (postfx_intensity_bloom), contrast about its pivot, saturation and a filmic curve to the shown sRGB image.
  • UI and command line. A weather list next to the time of day in Map 3D, and --weather W.
  • Model viewer unchanged. The mesh and cell shaders are shared; the scene uniform's flag keeps the model viewer on its own light. The atmosphere bindings sit in group 0 (bindings 6 to 11) of every pipeline; the viewer binds them unused.

Own choices (not decoded)

Incident-meter share, low-sun floor, bounce albedo, map tile reflectance, scale from the timecycle's colour values to scattering per km (so the defaults give the usual Earth atmosphere), moon illuminance (0.25 lux), star and air-glow brightness, night scenes metered up to 3 stops darker than mid grey, sun dimming by cloud cover (no clouds drawn yet), emissive brightness (6 cd/m² at strength 1), the filmic curve. Without a timecycle (no index), built-in Sunny values.

Checked

  • naga validates both shader modules (atmo::tests::shaders_validate). Scene layout, fallback sky and aerial depth tests pass.
  • cargo check -p sixng-gui --tests gives no warnings, after merging master.
  • On an RTX 3090 (Vulkan), release build: cargo test -p sixng-gui atmo:: passes. No panics and no wgpu validation errors in any run.
  • Screenshots at the same poses as master:
    • Street level, 13h sunny: blue sky, green land with detail, navy water. Master had a flat grey sky.
    • 500 m, 13h: relief, roads and blocks clear.
    • Sunset (19.6h): warm gradient sky with the sun's disc above the horizon. The land still has a strong golden cast.
    • Night (23h): stars, dark land, faint hills.
    • Misty 8h: haze that grows with distance and brightens toward the sun.
    • 3000 m, 15h: mountains and lowland look right; aerial haze over the far ocean is still light.
  • Frame time matches master at every terrain pose (60 fps, vsync). In the city, with shadows off (see the next PR), render CPU is 24.4 ms against master's 23.4 ms.
  • Model viewer: unchanged look (car shaded with paint, chrome, glass and its ground shadow).
  • Not from this PR, also seen on master: a seam across the terrain at 500 m, and stair-step ocean tiles from high up.
**@⁠holdmysocks** on GitHub · 2026-11-25 15:05 UTC · [original](https://github.com/holdmysocks/SixNG/pull/286) `holdmysocks:six-map3d` → `master` · +1844 −43 · 11 files · 11 commits · merged 2026-11-25 18:33 UTC Part 1 of the Map 3D rebuild (SIX-211): the map renders an HDR frame lit by the game's own sky, from the timecycle. Builds on #276 (the timecycle table, merged). ## What changes - **Physical sky from the timecycle.** The `sky_new_*` variables describe the atmosphere: planet radius, atmosphere top (Karman line), Rayleigh and Mie scattering with their scale heights, Mie absorption and phase eccentricity, and a two-piece ozone layer (its constants match the usual ozone profile exactly). `atmo.wgsl` renders it with look-up tables in compute passes: transmittance (256 × 64) and multiple scattering (32 × 32) when the medium changes, then per frame the sky seen from the camera (192 × 108), a 32³ froxel volume of aerial perspective (40 km deep near the ground, out past the horizon from higher up) and a 6-direction ambient cube. The sun's disc (`sky_sun_disc_size`), a full moon opposite it, stars (`sky_stars_*`) and the night air glow (`sky_air_glow_*`) are drawn on top. - **Physical light on surfaces.** The sun's illuminance (`sky_scattering_sun_illuminance`, ~100 000 lux) × `light_dir_col` × `sky_scattering_sun_col` × `light_dir_sun_mult` reaches each point through the air (transmittance table), so a low sun turns orange and fades; the moon likewise. The sky's light is the ambient cube, scaled by `ambient_sky_intensity` × `indirect_light_sky_multiplier`, plus sunlight bounced off lit surroundings (`ambient_bounce_intensity` × a 15 % ground albedo). Reflections read the sky table. The two height fog layers (`local_atmosphere_fog_density/falloff/height`, e.g. Misty, Fog) are applied per pixel. - **HDR frame, exposure, post.** Map 3D renders into RGBA16F. The exposure meter is three parts incident light at the camera (sun, moon and sky on a level grey card; a low sun counted as if 20° up) to one part a histogram of the frame between the timecycle's low and high percentiles; it moves to the key value at the timecycle's adaptation rate (`postfx_exposure` as an offset). Baked map tiles are lit at 60 % of their colour (they carry their own light). Then bloom (`postfx_intensity_bloom`), contrast about its pivot, saturation and a filmic curve to the shown sRGB image. - **UI and command line.** A weather list next to the time of day in Map 3D, and `--weather W`. - **Model viewer unchanged.** The mesh and cell shaders are shared; the scene uniform's flag keeps the model viewer on its own light. The atmosphere bindings sit in group 0 (bindings 6 to 11) of every pipeline; the viewer binds them unused. ## Own choices (not decoded) Incident-meter share, low-sun floor, bounce albedo, map tile reflectance, scale from the timecycle's colour values to scattering per km (so the defaults give the usual Earth atmosphere), moon illuminance (0.25 lux), star and air-glow brightness, night scenes metered up to 3 stops darker than mid grey, sun dimming by cloud cover (no clouds drawn yet), emissive brightness (6 cd/m² at strength 1), the filmic curve. Without a timecycle (no index), built-in Sunny values. ## Checked - naga validates both shader modules (`atmo::tests::shaders_validate`). Scene layout, fallback sky and aerial depth tests pass. - `cargo check -p sixng-gui --tests` gives no warnings, after merging master. - On an RTX 3090 (Vulkan), release build: `cargo test -p sixng-gui atmo::` passes. No panics and no wgpu validation errors in any run. - Screenshots at the same poses as master: - Street level, 13h sunny: blue sky, green land with detail, navy water. Master had a flat grey sky. - 500 m, 13h: relief, roads and blocks clear. - Sunset (19.6h): warm gradient sky with the sun's disc above the horizon. The land still has a strong golden cast. - Night (23h): stars, dark land, faint hills. - Misty 8h: haze that grows with distance and brightens toward the sun. - 3000 m, 15h: mountains and lowland look right; aerial haze over the far ocean is still light. - Frame time matches master at every terrain pose (60 fps, vsync). In the city, with shadows off (see the next PR), render CPU is 24.4 ms against master's 23.4 ms. - Model viewer: unchanged look (car shaded with paint, chrome, glass and its ground shadow). - Not from this PR, also seen on master: a seam across the terrain at 500 m, and stair-step ocean tiles from high up.
sixng-core daylight: resolves the 12 weather types (weather type -> base
cycle GLOBAL region + modifier stack with submodifiers), interpolates the
13 time samples with their easing, and derives sun/moon direction, colour
and strength, ambient tint and strength and exposure. sixng daylight
prints them. The model view's Light section gets a weather list; viewer
default keeps the old light set-up.
Sunrise ~06:10 and sunset ~19:50 match where the cycle's directional
colours change from moonlight to sunlight; the sky stays lit down to -10
degrees.
HDR frame for the 3D map: the timecycle's atmosphere (sky_new_*) rendered
with transmittance, multiple-scattering, sky-view and aerial-perspective
tables; sun, moon, stars and air glow; surfaces lit by the sun's
illuminance through the air and the sky's ambient cube; the two height
fog layers; an exposure meter with the timecycle's percentiles, key value
and adaptation; bloom, contrast, saturation and a filmic curve. Weather
picker and --weather for Map 3D. The model viewer keeps its own light.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 20:24:39 +00:00
github manually merged commit fe96d61bcf into gh-pr/286/base 2026-11-26 20:24:40 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.