Data in the Procedural Content Generation (PCG) Framework is divided into the following types:
Spatial Data
Spatial data contains references to two-dimensional (2D) or three-dimensional (3D) space and can represent volumes, heightfields, splines, and point data.
Volumes
Volumes are a type of spatial data that represents 3D shapes that is often used for boolean set operations or sampling directly from the level using the Volume Sampler node.
Surfaces
Surfaces are a type of spatial data that represents data that is 2D, such as Landscapes, which are mapped to the XY plane, or the Surface Sampler node that generates points on a 2D plane and projects them onto a 3D shape.
Textures
Textures are a type of surface data that represents a 2D texture mapped to the XY plane. This data type is referenced in the PCG graph using the Get Texture Data node, which generates points by sampling the texture, and the Sample Texture node, which samples the texture color at each point.
Render Targets
Render Targets are a type of surface data that represents a 2D render target, and are sampled the same way as textures. Render target data is often produced by the Scene Capture node, which captures an orthographic view of the level.
Texture Arrays
Texture Arrays are a type of surface data that represents a 2D texture array or 2D render target array, where each slice is a 2D texture of the same size. Converting a texture array to points creates one point per texel in each slice, and the ArraySlice attribute records which slice each point comes from. This data type is referenced in the PCG graph using the Get Texture 2D Array Data node.
Virtual Textures
Virtual Textures are a type of surface data that represents a Runtime Virtual Texture in the level. Unlike textures and render targets, virtual textures are sampled on the GPU, such as in the Custom HLSL node. This data type is referenced in the PCG graph using the Get Virtual Texture Data node.
Points
Point Clouds are a type of spatial data that represents a collection of points representing surfaces or volumes in 3D space with associated bounds. The bounds allow the points to represent shapes in different dimensions.
For example, a 3D sphere can be sampled to points, with the point size determining how closely the sphere shape is respected by the points.
Additionally, each point is given a Density value, normally between 0 and 1 (default 1). Together, these points along with their density values represent a floating-point function in space. PCG graph nodes often create and manipulate sampling density values in space before subsequently taking the samples.
Points can contain the following information:
| Data | Description |
|---|---|
Transform | Translation, Rotation, and Scale information. |
BoundsMin and BoundsMax | Minimum and maximum extents of the volume represented by the point. |
Color | Four channel color value per point. |
Density | Floating point representation of a point's falloff in relation to other points in a given sampling. Used to determine sampling density. |
Steepness | Softness of the volume represented by a point. Each point has 3D bounds and represents a region of space. The Steepness value on each point gives control over the shape of its influence. |
Seed | Consumed by random number generators during various operations. This can be manipulated to control how randomness is expressed and is computed from the position in runtime in order to be world-position consistent. |
In addition to these values, attribute selectors can read the following properties, which are derived from the transform and bounds:
$Position
$Rotation
$Scale
$Extents (half the size of the bounds)
$LocalCenter (the center of the bounds)
$LocalSize (the size of the bounds)
$ScaledLocalSize (the size of the bounds after scale is applied).
Lines
Lines are a type of spatial data (shown as Polyline or Curve in the PCG UI elements) that represents Spline and Landscape Spline components, and Polygon 2D data. This data reads the spline's key points with tangents and point scales. Points sampled from a Landscape Spline stay at the spline's height, even if the spline is offset from the Landscape. This data type is referenced in the PCG graph using the Get Spline Data and Spline Sampler nodes.
Polygon 2D
The Polygon 2D type represents an area as a closed shape, which can be converted to a surface or spline data for sampling or specific operations.
Polygon 2D data can be modified with the following operators:
| Operator | Description |
|---|---|
Create Polygon 2D | Takes point data or spline data and turns it into a Polygon 2D. |
Polygon Operation | Polygon-to-polygon operations, options are:
You can use splines to cut Polygon 2D to subdivide or isolate a shape. For example, you can slice a larger area using spline data into a grid pattern, then use that pattern to create individual city blocks in a city generator graph. |
Clip Paths | Used to intersect or difference splines with Polygon 2D shapes. |
Offset Polygon | Applies an offset to a Polygon 2D shape to make it larger or smaller, and handles overlap. |
Create Surface From Polygon2D | Turns a Polygon 2D into a surface that can be sampled using the Surface Sampler node to create points over its area. |
Primitives
Primitives are a type of spatial data that represents the collision of a primitive component, such as a Static Mesh component, and can be sampled like a volume. This data type is referenced in the PCG graph using the Get Primitive Data node.
Dynamic Meshes
Dynamic Meshes are a type of spatial data that represents an editable mesh and its materials, which can be modified using operations such as booleans, merges, and transforms. This data type is referenced in the PCG graph using the Get Dynamic Mesh Data node, provided by the PCG Geometry Script Interop plugin.
Composite Data
Composite data is the result of set operations, such as union, intersection, and set difference.
You can chain set operations together as multiple operations before converting the result back to explicit data and applying the result.
Attribute Sets
Attribute sets are user-defined variables and stored in the PCG graph as Metadata. These variables can be manipulated using various attribute operation nodes and consumed by nodes.
A common example of this is to drive node settings found by expanding out the advanced pins on the node and connecting an attribute to the exposed pins.
The available Attribute inputs on the Transform Points node.
Attributes can be inspected in the Attributes panel of the PCG graph editor. For more information on using the PCG Framework, see Procedural Content Generation Overview.
Resource Data
Resource data represents an asset, such as a Static Mesh, rather than a region of space. Unlike spatial data, it has no bounds and cannot be sampled.
Static Mesh Resource
Static Mesh Resources are a type of resource data that references a Static Mesh asset. This data type is created in the PCG graph using the Get Static Mesh Resource Data node, and can be converted to an attribute set containing the asset path using the Get Resource Path node.