Viewer: time of day and weather lighting from the game's timecycle #276
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/holdmysocks--SixNG!276
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/276/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@holdmysocks on GitHub · 2026-11-25 13:55 UTC · original
holdmysocks:claude/viewer-time-of-day→master· +748 −6 · 7 files · 2 commits · merged 2026-11-25 14:33 UTCAdds time-of-day and weather lighting to the model viewer, read from the game's own timecycle.
What changes
sixng-core::daylight: builds a variable table for each of the 12 weather types (sunny, clear, clouds, overcast, overcastdark, misty, fog, drizzle, shower, rain, thunderstorm, hurricane) from the timecycle documents the existingtimecycledecoder already reads. Each named weather goes through the weather list's indirection to its weather type. That type gives a base cycle (itsGLOBALregion, 13 time samples) and eight modifier fields. The modifiers and their submodifiers are applied in order, and a later one wins. A modifier either sets a constant or sets a curve over the day (keyframe_t_value). Any hour is interpolated between its two neighbouring samples, eased with the earlier sample's easing (linear, or quartic in-out). A curve is read at hour / 24. The table is decoded fromcommon.rpfon first use and cached in<work>/cache/daylight.json, which takes about 2 s.sixng daylight [--weather ..] [--hour ..] [--var ..] [--rebuild]prints the resolved values and the light derived from them.--weather Wwith--tod Hdoes the same for command-line screenshots.Lookinputs (sun direction/colour/intensity, sky colours, ambient, exposure, emissive) are set. The hair and skin formulas are untouched.From the timecycle
light_dir_col_*,light_dir_mult, and for the sunlight_dir_sun_mult,sky_scattering_sun_intensity_multiplierandsky_scattering_sun_col_*; for the moonlight_dir_moon_multandsky_moon_col_*. Ambient comes fromambient_sky_intensityxindirect_light_sky_multiplier, tinted byambient_sky_color_mult_*xsky_scattering_sky_col_*. Alsopostfx_exposureand the high-levelcloud_cover.Not decoded (our own simple model, documented in
daylight.rsand the README)The game feeds these multipliers into a physical sky and eye adaptation that we haven't decoded. The viewer therefore uses its own models for:
Directional and ambient strength are scaled so that Sunny at 12:00 equals the viewer default. Which sample's easing applies to a segment (the earlier one) is our reading. Region modifiers, interiors and the
URBANregion aren't used. Fog isn't set.Checked
sixng daylight):cargo build --releaseandcargo test --release -p sixng-core -p sixng-guipass with-j 8: 273 + 30 tests, no warnings.--weather/--tod):