The Procedural Content Generation Framework (PCG) is a toolset for creating your own procedural content and tools inside Unreal Engine. The framework contains several PCG generation modes to facilitate the creation of larger worlds using PCG. Generation modes split the generation domain of a PCG Component into a grid, with each cell containing its own local PCG component.
PCG forest example spawning trees, grass, and other ground cover on a slope.
On a large grid, you can generate large, visually prominent meshes, such as trees and boulders. On a small grid, you can create smaller details, such as grass, flowers, and stones. This approach provides more granular control over the execution of PCG tools and is used to fine-tune the performance of tools that cover a large area.
There are four PCG generation modes:
- Non-partitioned Generation (default)
- Partitioned Generation
- Hierarchical Generation
- Runtime Generation
Using Partitioned Generation
By default, all meshes generated by a PCG component are contained within the component’s domain, such as a volume or tied to a spline. This mode works for smaller PCG assets but can cause performance issues for assets that cover a large area. Partitioned Generation generates the resulting meshes across a user-defined grid. The data is split between each cell, making it easier to stream using other systems, such as World Partition and Level Instancing.
An example of a partitioned PCG component.
Enable Partitioning in the Graph
To toggle Partitioned Generation on a PCG component:
Toggling PCG Partitioned Generation in the PCG Volume Details panel.
- Select the PCG asset in your level.
- Click the checkbox next to Is Partitioned in the Details panel.
Configure the Partition Grid Size
The size of the partition grid is defined by the Partition Grid Size option on the PCGWorldActor:
Configure the Partition Grid Size option on the PCGWorldActor.
To configure the grid size:
- Select the PCGWorldActor in the Outliner.
- Adjust the value of the Partition Grid Size option.
- Select each PCG asset in your level and click Cleanup in the Details panel.
- Click the Generate button to regenerate the result.
Using Hierarchical Generation
Hierarchical Generation supports mesh generation using PCG at multiple scales. This type of generation overrides the Partition Grid Size used in Partitioned Generation using the Grid Size node and gives you the ability to fine-tune your mesh generation.
Example showing highlighted rocks generated on a smaller grid size.
The Grid Size node customizes the size of the generation grid for all data generated downstream of it and should be placed before any sampler nodes.
Enable Hierarchical Generation in the Graph
To enable Hierarchical Generation in your PCG graph:
Toggling PCG Hierarchical Generation in the PCG Graph Settings.
- Open your PCG graph and click the Graph Settings.
- Click the checkbox next to Use Hierarchical Generation.
- Open the dropdown box for HiGen Default Grid Size and select a value.
- Save your PCG graph.
Hierarchical Generation requires that your PCG components are partitioned. Make sure Partitioned Generation is enabled in your level before using this feature.
Configure Grid Size Settings
Use the Grid Size node to customize the generation of your meshes in the PCG Graph:
Setting the Hierarchical Generation grid size using the Grid Size node.
- Search for and add the Grid Size node before the sampler node in each branch of your PCG graph where you want to override the default hierarchical generation grid size.
- Click the Grid Size node and adjust the HiGen Grid Size setting.
- Save the graph.
- Regenerate your result in your level.
Use the size of your mesh to help determine the appropriate grid size in the graph. Large meshes are often less numerous than smaller meshes and should be placed on a larger grid to facilitate streaming. Smaller meshes are more numerous and should be placed on a smaller grid size.
Hierarchical Generation uses the following execution guidelines:
- Nodes that do not follow a Grid Size node in your PCG graph will generate data using the value defined in the HiGen Default Grid Size setting.
- Data generated on a larger grid size is available as cached data during the execution of a smaller grid. It cascades down a graph from larger grid size to smaller grid size but does not go from a smaller grid to a larger grid.
- If a node has multiple inputs using data from multiple grid sizes, the output is generated using the smallest grid size.
Using the Unbounded Grid Size
In the example below, a Mesh Sampler node is sampling a boulder mesh across a PCG volume:
Example showing the use of the Unbound grid size
The sampler samples the volume contents at the HiGen Default Grid Size and runs the performance-intensive operation four times, one for each grid cell in the volume. With this graph setup, performance worsens as the volume size increases.
For situations like this, it is recommended to use the Unbounded grid size. Unbounded removes the grid restriction for the PCG component and will execute nodes using this grid size once. Then, grid restrictions can be applied using the Grid Size node.
PCG subgraphs have their grid sizes disabled and use the grid size of their input data or parent graph.
It is possible to generate duplicate point data when passing data from a larger grid to a smaller grid. This occurs when data generated for a larger grid is replicated in every grid cell of a smaller grid and will significantly impact performance. You can remove the duplicate data by using the Cull Points Outside Actor Bounds node to remove the points from the point data that exists outside the smaller grid cell.
Using Runtime Generation
Runtime Generation is a special generation mode for PCG components that generates and cleans up dynamically in proximity to PCG Generation Sources. It is available in-editor, PIE, and standalone builds.

Runtime Generation is most effective when paired with Hierarchical Generation, to efficiently scatter higher levels of detail only where it is needed.
Generation Sources
Generation sources represent points in the world that cause nearby runtime generated components to generate meshes.
Similar to World Partition, PCG uses the following as streaming sources:
- Editor Viewport sources: Sources attached to the active or focused editor viewport when the Treat Editor Viewport as Generation Source option is toggled on the PCGWorldActor.
- Player sources: Sources attached to player controllers in the level.
- World Partition streaming sources: Sources attached to anything that acts as a streaming source provider from the World Partition system (PlayerController, WorldPartitionStreamingSourceComponent, etc.).
- PCG Generation Source Components: Sources used as a general purpose generation source that can attach to any actor.
The Generation Radii setting in the PCG Graph determines the range at which generation sources affect PCG components and is set for each partitioned grid size. When a runtime generated PCG component lies within this radius, it is scheduled for generation. When a component is no longer within this radius (scaled by the Cleanup Radius Multiplier), it is cleaned up.
Generation Radii can also be overridden on each PCG component in the level using the Details panel by toggling the Override Generation Radii setting.
The base Generation Radius applies to non-partitioned components, and the Unbounded grid level for partitioned Hierarchical Generation components.
PCG Generation Radii settings found in the PCG Graph settings.
It is recommended to avoid small grid sizes having a larger generation radius than larger grid sizes. Each Generation Radius should be increasing in size over the previous one.
Scheduling Policies
Scheduling policies are used to provide practical rules for the order in which runtime generated components are scheduled to generate. The default scheduling policy uses distance and view direction to prioritize generating components that are in front of and nearby a generation source.
Scheduling policies are set on a per-component basis, and are found in the PCG component Details panel.
PCG Scheduling Policy settings located in the Details panel of a PCG asset.
Enable Runtime Generation
To enable Runtime Generation in your PCG graph:
In the Details panel of your PCG asset, Change the Generation Trigger to Generate at Runtime.
To test Runtime Generation in the viewport:
- Select the PCGWorldActor in the Outliner.
- Ensure the checkbox for Treat Editor Viewport as Generation Source is enabled.
You should see the meshes generated in a radius around the camera view in the viewport.
Configure Runtime Generation
The generation radii are defined for each grid size level in the PCG Graph settings or can be set in the Details panel of a PCGComponent to fit your level’s needs.
To configure the generation radii:
- Open the PCG Graph Settings and expand Runtime Generation > Generation Radii.
- Adjust the generation radius for each grid size. The Generation Radius option is applied to the default grid size or when you use the Unbounded option.
- Adjust the Cleanup Radius Multiplier. This multiplier applies to the generation radius to determine the radius at which meshes are removed from the level.
- Save the graph.
The PCG asset will now only generate meshes in a radius around the viewer.
Debugging and Runtime Overrides
There are several useful console commands for debugging Runtime Generation during runtime.
Console Command | Description |
---|---|
pcg.RuntimeGeneration.Enable | Toggles Runtime Generation. |
pcg.RuntimeGeneration.EnableDebugging | Toggles verbose logging for the Runtime Generation Scheduler to get insight into its exact behavior. |
pcg.RuntimeGeneration.EnablePooling | Toggles pooling for runtime generated Partition Actors to avoid constant allocations. This option is enabled by default. |
pcg.RuntimeGeneration.BasePoolSize | Sets the initial number of runtime generated Partition Actors in the pool. Set to 100 by default. |
pcg.RuntimeGeneration.FramesBetweenGraphSchedules | Sets the number of ticks the Runtime Generation Scheduler must wait between scheduling components for generation. Useful when debugging your scheduling policy to observe the exact order in which components are being scheduled. Set to 0 by default, which allows all generations to be scheduled in a single tick. |
pcg.FrameTime | Allocates time (in milliseconds) for PCG to execute per frame. Set to 16.667 ms by default. |
pcg.EditorFrameTime | Allocates time (in milliseconds) for PCG to execute per frame when running in editor (non-PIE). Set to 50 ms by default. |
Visualizing Grid Size in the PCG Graph
Use the Debug Object Tree to visualize the grid size used by each node in the PCG graph.
To visualize the grid size in the PCG graph:
- Select a local PCG component from the Debug Object Tree list located in the bottom left. Each component name contains the grid size. For example,
PCGPartitionActor_12800_1_5_0/PCGComponent_1/NewPCGGraph
is part of the 12800 cm grid.. - Click the arrow next to the component name and select the component.
Example showing the visualization of the Hierarchical Generation grid size.
In the above example, a component spawning tree meshes is selected (1). The nodes that spawn rock meshes (2) and grass meshes (3) are grayed out, showing that these nodes are spawning trees on a smaller grid size and will execute after the tree nodes. Each node displays its grid size in meters in the top right corner.