Builtin Library
- ..
- README.md819 B
- preview.png26.9 KB
- properties.yaml798 B
- shader.wgsl2.0 KB
README.md
foliage.shader
Vegetation that sways with the scene's wind.
The motion comes from the engine's frame-global wind (rendering.setWind), so
every material reading it agrees on direction, speed and gust phase — a gust
crosses a whole field instead of each plant animating on its own clock.
compliance scales how far this material yields — 1 for a grass blade, 0.1 for
a trunk. The mesh's red vertex channel is how freely each vertex moves: 1 at a
blade's tip, 0 at its root, so a blade pivots from its base. A mesh with no
authored vertex colours reads white and sways as a whole.
The gust phase is a function of world position, so a gust travels across a field rather than every instance of the same mesh swaying in unison.
With no wind set the sway is zero and the surface renders as a plain lit material.