LerpworksAcademy
On this page

World and levels › Vegetation and placement

Plant a forest by rules in PCG

Know first: Scattering by rules

This flow builds a PCG graph in Unreal that plants a forest by rules. Trees stand only on gentle slopes and below a set height. Noise cuts the clearings, and not a single trunk lands in the lake or on the road. Sizes and rotations vary, trunks never grow into each other, and bushes fill in under the trees. It is the hands-on companion to the lesson Scattering by rules. That lesson explains why each sieve works the way it does; this one tells you which nodes to place and what to type in.

Goal

Before: a landscape with hills, a lake and a road. After: a PCG_Forest graph that fills the whole volume with forest by rules. When you edit the lake or the road, the forest recalculates by the same rules. The numbers below are an example; use your own.

Get LandscapeData SurfaceSampler Normal ToDensity Density Filterslope Attribute Filterheight Spatial Noise+ Density Filter Get Spline Datalakes → surface Get Actor Datamanual zones Get Spline Dataroad → points Differenceminus lakes, zones Distance+ Density Filter TransformPoints Self PruningLarge to Small Static MeshSpawner solid arrows: forest points; dashed: what is subtracted
The graph of the main pass, which plants the trees. The colored frames mark the sieves and the subtraction. A second pass of the same graph plants the bushes (step 12).

Further in the article

  1. What you need to start
  2. Steps
  3. If it doesn’t come out right
  4. Checklist
  5. Theory
  6. Sources and further reading
  7. Test yourself