fix(weather)

The shadow that missed its object

Neal367Neal367/Nov 30, 2026

Cloud shadows slid across the ground beside a pillar instead of over it. The ground darkened and lifted while the pillars stayed at a constant brightness.

The mask built its own fixed direction — azimuth 45, elevation 50 — and never read the sun. With the layer at 70 m, that put the sample point 55.1 / 41.6 / 121.3 m from the real one at t=0.25 / 0.50 / 0.75. Toggling the clouds at a fixed instant moved 27.4% of ground pixels and 0.0% of pillar pixels: not a gradient, a hard zero, which meant the objects were never in the calculation.

The projection is now the sun's, keeping the height term that makes an edge climb a pillar:

t     = (layerHeight - worldPos.y) / toSunDir.y
hitXZ = worldPos.xz + toSunDir.xz * t

cloudShadowSunFollow (shipped 1) dials back to the old look at 0, so the change is reversible from the asset.

The cost, stated: the ground pattern now sweeps as the sun moves, about 3 m/s on the 120 s debug day. A previous session removed the sun specifically to stop that sweep, and that is what broke the object interaction.

Nine shaders compile clean; 169 edit-mode tests, one skipped (a GPU parity test that needs a device). Two time-of-day play-mode tests fail — proven pre-existing by stashing the tree back to the parent commit and watching them fail identically. Next is the pair: a clear colour reading 0.03 where 0.55 is expected, and dawn/noon elevations coming out equal.