render3d: the shadow array holds only the cascades a fog wall needs, and a thick fog takes the whole sky

A cascade that begins past the wall was fitted and cleared every frame for nothing: the array is now
made with the ones that begin inside it (2 at 30 m, 3 at 175 m, 5 without a fog) and made again when
the wall changes that count; shadow maps 80 -> 32 MB at 30 m, 48 MB at 175 m. A layer the array lacks
clamps to its last, read only past the wall where everything is fogged.

The sky: at walls of 110 m and nearer the whole sky is the fog's colour, overhead too, with a soft
glow at the sun or moon and no stars or clouds through it, easing out by 175 m; from 175 m on the
horizon band alone, and off as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-29 16:10:58 +03:00
parent 7024f42789
commit 4d485a1778
6 changed files with 40 additions and 3 deletions

View file

@ -117,6 +117,15 @@ void main() {
if (u_fog_wall > 0.0) {
float band = clamp(90.0 / u_fog_wall, 0.06, 0.75);
col = mix(col, fogWallCol(dir), 1.0 - smoothstep(-0.02, band, dir.y));
// a thick fog (110 m and nearer, easing out by 175 m) takes the whole sky, overhead too: no
// stars and no clouds through it, only a soft glow where the sun (in fogWallCol) or the moon is
float cover = 1.0 - smoothstep(110.0, 175.0, u_fog_wall);
if (cover > 0.0) {
vec3 thick = fogWallCol(dir);
float mg = pow(max(dot(dir, u_moon_dir), 0.0), 12.0) * u_moon_illum * night * step(-0.08, u_moon_dir.y);
thick += vec3(0.55, 0.6, 0.7) * 0.05 * mg;
col = mix(col, thick, cover);
}
}
o_color = vec4(sane(col), 1.0);
}