June 24, 2026 · 1 min read

🌬️ A tiny shader for wind

A minimal vertex shader that adds believable wind to foliage without much setup.

Wind is one of those effects that sells a scene instantly. Here's the smallest version I keep reaching for.

The idea

Offset each vertex by a sine wave, scaled by how high up the vertex sits — so the trunk stays put and the tips move most.

float sway = sin(time + worldPos.x) * heightMask;
position.xz += sway * strength;

Written out, the horizontal offset for a vertex is o=Asin(ωt+ϕ)mho = A \sin(\omega t + \phi)\, m_h, where mhm_h is the height mask and AA, ω\omega, ϕ\phi are amplitude, frequency and phase:

o=Asin(ωt+ϕ)mho = A \sin(\omega t + \phi)\, m_h

Add a second wave at a different frequency and you get something that reads as natural motion rather than a metronome.