Forest-Basic #
Besides our advanced Biome generation toolkit, we have a very basic pcg forest graph available. This documentation is only focussed on that system.
Principles of the system #
PCG works by creating points on a landscape and spawning actors or meshes on those points. When the points are created, we put a box around tree etc based on their size. After that we’re excluding all points in water and exclusion box. At last, we’re spawning all the static meshes in the world.
PCG_SubGraph_DensityPropegation #
This subgraph can be used to filter points across 3 density ranges. The ranges can be set in the parameter overrides of the subgraph.

PCG_SubGraph_Exclude #
This subgraph excludes water bodies (Water Body Ocean by default) and any area that has the PCG_Exlude Tag, this can be colliders but also meshes.
Categories #

Instead of using tags, which gets merged in the Merge node, we use custom attributes to determine which point belongs to which type. For example, PCG_SubGraph_Trees generates points with categories Tree_Large, Tree_Medium, and Tree_Small. After we merge and self-prune with all the other points, we can use a point filter to filter out all the separate trees and spawn the correct mesh.

Spawning actors / static meshes #
When all the points are generated, we want to spawn the required actors or static meshes on those points. We’re doing that by using a density propagation subgraph. This has several densities, this way you can change the separation between each spawned actor.


Replacing Meshes #
- The system includes a few example meshes. These can be replaced by swapping out the mesh entries in the static mesh spawners

- If you prefer to spawn actors instead, you can replace these nodes with Spawn Actor nodes.

- To use the graph, the asset can be dragged into a level from the content browser/drawer, this will automatically create a pcg volume. You can also manually place a pcg volume in your level and asign the pcg graph on the pcg component.
To adjust the size of the pcg volume it is recommended to first press the cleanup button inside of the pcg component to prevent the pcg graph from regenerating while scaling the volume.

Use cases #
Replacing a tree to a new static mesh #
When replacing a tree you should check various things. First of all you need to set the size that should be excluded around that tree for other spawns. This way the meshes won’t spawn into each other. You should change the extents variable based on the size that you prefer in the PCG_SubGraph_Trees.

After having done that you can change the actor or static mesh that is spawned in the trees part of the PCG_Forest.

This process is basically the same for all other static meshes.
Adding new PCG content #
To add new PCG spawned items in the PCG spawner you have to perform a few actions. First of all you should add a surface sampler and modify it to your liking. After that you can create a subgraph for your specific meshes. You can copy most of the other subgraphs and also change it to your liking. After that connect that subgraph to the merge node.
At the right side of the graph you can drag out of the to point node to get your points. You should create a point filter with the name given in the subgraph. After that you can use the densitypropegation to spawn the actors based on density.
Change density #
To change the density of spawned objects you only need to change the points per squared meter variable inside the surface sampler.

