Your browser sucks, JavaScript disabled! Gunnar's console needs JavaScript and WebAssembly. Git over SSH on port 2222 does not.

nordisk/facett

facett-map3d-flight/.nornir/daycycle-guide.md

Time-of-day sun driver + weather — guide

What it does

Animates the sky. Given where you are (latitude_deg), the date (day_of_year), the clock (hour) and the weather, it produces a SunSky (sun direction, colour, intensity + sky/ambient tint) that plugs straight into the existing 3D render path.

Use it

use facett_map3d_flight::{Atmosphere, DayCycle, Weather};

let atmos = Atmosphere::earth();                 // build once (transmittance LUT)
let mut cycle = DayCycle {                        // Sweden, midsummer, clear
    latitude_deg: 59.5, day_of_year: 172,
    weather: Weather::clear(), exposure: 12.0,
};

// per frame, for the current time-of-day + camera altitude:
let (sky, horizon) = cycle.sun_sky(hour, &atmos, altitude_m);
// feed the shared uniforms your renderer already uses:
let light = sky.light_uniform();   // [dx,dy,dz, ambient]
let sun   = sky.sun_uniform();     // [r,g,b, intensity]
let skyu  = sky.sky_uniform();     // [r,g,b, horizon_bias]

Demo

facett-demo/src/demo_photoreal.rs (PhotorealDemo) is the interactive toggle: an hour slider, latitude/season sliders, an overcast switch and live sun/sky swatches. Its state_json() is the headless oracle the self-test drives.

Determinism

No clock, no RNG — two identical queries return bit-identical results (FC-7), so a scripted flythrough is reproducible and the sky is snapshot-stable.