Procedural Foliage (PCG)

See my “Auto Landscape Material” post for the landscape shader.


This procedural foliage was developed alongside my landscape auto material using Unreal’s procedural content generation system (PCG). I decided to use PCG over the landscape grass system for its versatility.

I use custom physical material masks to determine where foliage is generated on the landscape. These masks are created by adding/subtracting the landscape layers’ slope blend and/or world height data. By having highly accurate physical materials for auto materials, this allows for easy integration with other systems requiring them like footstep sounds/particle effects. Each mask can be viewed below:

*Priority refers to which mask overwrites the others.

Base Layers

Grass Mask (Low Priority)

Shoreline Mask (High Priority)

Dirt Mask (Lowest Priority)

Cliffs Mask (Medium Priority)

Snow Line Mask (Highest Priority)

 

Physical Material Output Inside Landscape Material

 

For the PCG graph, I grab the landscape data and filter out the physical materials for determining where foliage can spawn; along with the needed logic to generate transform points and using the difference between foliage outputs to prevent grass/rocks/trees from spawning inside each other.

 

PCG Graph

 

The shoreline was a special case because I needed to filter out the transform points based on world Z height instead of just the physical material itself. This way, coastal rocks could spawn on the waterline itself ( Z = 0 ) and small rocks could generate above it ( Z > 0 ). This also allows underwater plant/rock generation ( Z < 0 ).

 

PCG Graph - Shoreline Spawning

 

Lastly, like the landscape material itself, the foliage has been optimized and is game-ready. All foliage is from Quixel Megascans and custom materials were made to keep shader complexity low with minimal quality loss. They also have nanite enabled for highly performant, dense forests.

 

Forest (Lit View)

Forest (Shader Complexity View)

 
Animeke

Creator of animeke.moe, an anime content hub.

https://animeke.moe
Previous
Previous

Auto Landscape Material