TREEGEN
Devlog/TREEGEN/Code

How TREEGEN bakes realistic wind animations

January 20, 20261 min readCode

Trees in games need to sway in the wind, but runtime simulation of thousands of branches is too expensive. TREEGEN's solution: bake the wind into vertex colors at generation time.

The algorithm assigns each vertex a "sway weight" based on its distance from the trunk and branch order.

We use a multi-frequency Perlin noise to drive the sway. Low frequencies create the broad tree-wide motion, while high frequencies add the detailed leaf flutter.

The shader reads these values and applies sine-wave displacement modulated by the baked weights. The result looks like full simulation but costs almost nothing at runtime.

LOD transitions were tricky — we solve this by interpolating vertex colors during LOD transitions, creating smooth blending.

T
Project
TREEGEN
View project →
← Previous
Making hits sound painful: FUNBRUN sound design
FUNBRUN
Next →
Hordbrun: rethinking tactical multiplayer
Hordbrun