Foliage & PCG
Generating foliage onto an existing surface.
Last updated
Generating foliage onto an existing surface.
Last updated
There is an example available on this topic!
As of this release, native Voxel Plugin foliage has been replaced with a PCG integration. This gives full control over scattering behavior, and allows for spawning actors (including voxel brushes) as well as the usual static meshes.
PCG updates from the Voxel Landscape can be paused using the voxel.landscape.DisablePCGRegen
console command.
With PCG comes the ability to analyze points and do contextual operations on them. This opens the door to things like combining multiple smaller cliff points into a single larger cliff mesh. The logic that would be used for that kind of behavior is generic to any PCG-based system.
The key node for anything voxel-related on the PCG side is the Get Voxel Landscape Data
node. This can be plugged into a Voxel Landscape Sampler
to spawn new points, or into a Voxel Landscape Projection
node to make existing points conform to the terrain. Both of these can be configured from the details panel to be height-based or volumetric.
Sometimes PCG will attempt to run its graphs before all the voxel-side data is ready. This can cause an otherwise functional graph to not spawn any instances. This can be prevented by using the Wait for Voxel Landscape
node whenever referencing voxel data. This will prevent PCG from running before the voxel data is computed.
When using PCG with Voxel Plugin, we strongly recommend:
On any PCG graph, setting Use Hierarchical Generation
to true.
Note that PCG's spline sampling does not work well with Hierarchical Generation. Use Voxel Metadata instead.
On any in-world graph actor:
Setting Generation Trigger
to Generate at Runtime
.
Setting Is Partitioned
to true.
On the PCG World Actor:
Setting Treat Editor Viewport as Generation Source
to true.
If the world isn't largely a heightfield (i.e. it contains lots of caves, or is a planet), setting Use 2DGrid
to false.