Foliage API – Adding trees procedurally to your level

The Foliage API is a great way to populate your level with trees using code. If you do it this way, then you can get some good results without having to manually produce a natural looking randomness by hand.

We will correlate the placement of foliage with the Perlin noise value so that the chance to place a tree at a given location is higher when the Perlin noise values are higher.

Getting ready

Before using the code interface to the Foliage API, you should try the in-editor feature to familiarize yourself with the feature. After that, we will discuss using the code interface to place the foliage in the level.

Tip

Important! Keep in mind that the material for a FoliageType object must have the ...

Get Unreal Engine 4 Scripting with C++ Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.