Files
horizon-airdef/crates
chexit acfb379aa8 Wind-blown leaves and plants carry their own motion vectors
The terrain vertex shader built prev_clip from the current wind-displaced position plus the
camera step, so the motion buffer knew only the camera: leaves and plants sway at 0.2-0.6 Hz
with up to 0.14 blocks of amplitude, and their history lagged the sway — the shimmer on foliage
and the distant treeline. The wind is a sum of whole-cycle waves over 256 blocks and 600 s, so
the previous frame's displacement is the same sway evaluated at the previous wind time and
strength: gfx.rs keeps them in taa_prev and passes them in Globals.hd_motion.zw (this frame's
when there is no previous one, so the wind's own motion is zero then), and terrain.wgsl's
wind_offset_at evaluates them for prev_clip. The spatial argument stays this frame's camera
wrap: the vertex's world position does not move. World-pass colour is unchanged (prev_clip
feeds only the motion buffer); the shadow pass inherits the globals and ignores prev_clip.

Co-Authored-By: Kimi Code <noreply@moonshot.ai>
2026-11-21 16:50:43 +03:00
..