Vivian Wu
Projects About

Foliage Shader

Run the demo here.

This shader uses signed distance fields and sphere tracing to procedurally generate foliage.

Unfortunately, it's computationally expensive and quite slow, but it will be interesting to explore whether a similar effect can be achieved with a different technique.

On a sphere, two layers of noise are applied: a coarse one to shape the clumps of foliage, and a finer one for the leaves.

By distorting the coordinates furthest from the center with sine functions, the 'branches' can sway in the wind.

Multiplying an additional, medium-grain noise with the large noise gives control over the density of the foliage.


Ray Marching and Signed Distance Functions, by Jamie Wong.

3D Gradient Noise, by IQ (Shadertoy).
Note: used for shaping the clumps of foliage, but everything else used a faster noise to improve performance