Fade between day and night #92

Closed
opened 2026-10-20 08:49:34 +00:00 by sermuns · 1 comment
Owner

daytime is a server-authoritative bool, and the client switches between two
hard-coded light presets when it changes. The entire campus, sky included, snaps
in one frame.

That snap is the most visible seam in the game after the flat sky, and it is also
why the two presets have to be tuned to be far apart: there is no moment in
between to be halfway pleasant.

Interpolate the photometric values client-side toward the server value over a few
seconds: sun and moon color and intensity, ambient, fog color, sky tint and
exposure. The sun direction is fixed in config today; keeping it fixed means the
shadow map does not rebuild during the fade, which is the cheap version. If a
moving sun ever lands (#7), the fade becomes a time of day instead.

Related: #7, #39 and #64 define what day and night should each look like, and
#79 and #90 provide the values to interpolate.

`daytime` is a server-authoritative bool, and the client switches between two hard-coded light presets when it changes. The entire campus, sky included, snaps in one frame. That snap is the most visible seam in the game after the flat sky, and it is also why the two presets have to be tuned to be far apart: there is no moment in between to be halfway pleasant. Interpolate the photometric values client-side toward the server value over a few seconds: sun and moon color and intensity, ambient, fog color, sky tint and exposure. The sun direction is fixed in config today; keeping it fixed means the shadow map does not rebuild during the fade, which is the cheap version. If a moving sun ever lands (#7), the fade becomes a time of day instead. Related: #7, #39 and #64 define what day and night should each look like, and #79 and #90 provide the values to interpolate.
sermuns added this to the Living campus milestone 2026-10-20 08:49:34 +00:00
Author
Owner

This landed, so this is closed.

The client keeps a daylight_ease that animates toward the server's daytime flag over DAY_NIGHT_FADE_SECONDS, and the same blend drives both the light values and the sky. frame_lights mixes the ambient intensity, the sun intensity and the sun color between the moon preset and the day preset by it, and the renderer mixes the night and day zenith, the cloud color and the cloud cover by the same factor. The sun direction is still fixed in the config, so the shadow map does not rebuild during the fade.

One small thing from the issue's list is left: the fog color is a single config value and is not interpolated, and the fog is switched off during the day by a bool rather than by the blend, so the distance haze still switches rather than fades. The sky's horizon color is that same fog color, so the seam is small.

This landed, so this is closed. The client keeps a `daylight_ease` that animates toward the server's `daytime` flag over `DAY_NIGHT_FADE_SECONDS`, and the same blend drives both the light values and the sky. `frame_lights` mixes the ambient intensity, the sun intensity and the sun color between the moon preset and the day preset by it, and the renderer mixes the night and day zenith, the cloud color and the cloud cover by the same factor. The sun direction is still fixed in the config, so the shadow map does not rebuild during the fade. One small thing from the issue's list is left: the fog color is a single config value and is not interpolated, and the fog is switched off during the day by a bool rather than by the blend, so the distance haze still switches rather than fades. The sky's horizon color is that same fog color, so the seam is small.
Sign in to join this conversation.
No description provided.