Related notes: Procedural, Level Design
PCG
Data driven Scriptable procedural content framework. Spawn meshes on points. We can cache and reuse calculations. Dependences: you can remove points from bigger assembly. You can spawn on level or on runtime. Smaller detail (without collision which is expensive to spawn) should be spawned Runtime to not overload RAM.
- PCG Graph - with instances
- PCG BP
- PCG Actor component
Useful tips:
- Subgraphs -use as fn Use graph inside other graph
- Tags
- PCG > Utilities > Actor Tagger > EUW_Actor_Tagger
- Data Assets » struct (with mesh information )
Shortcuts
A
- AttributesD
- DebugE
- Enable
Attribute & Property
- Static Attributes:
$Density
- A density of 0 is black, and a density of 1 is white.$Scale
,$Position.z
@Last
- dynamic attribute that was manipulated by the previous node.
- Dynamic Attributes:
- Runtime, and stored as part of the Metadata of the graph data
- Graph Parameters
- Customizable graphs
Extents
Bounds Modifier
- Change position (similar to extent)Extents Modifier
- Change scale of boxes (Bounds.Max-Bounds.Min)/2
Generation modes
Offline
- Default
On Demand
- BP nodes:
Generate
BP node - with PCG target will regenerate (force to generate even if not been before)Set Seed
- Set Seed of given PCG actorRuntime
- PCG component details:
Generation tirgger
Runtime- Overrid GEneration Radii > Shedule policy class
- [ ]
- Actor:
PCG World Actor
:- [v] Treat Editor Viewport as a runtime generation source
Partition
For large volumes - When enabled is moving generated meshes to partition actor.
You want to set it up with: Runtime
gen and HLOD Actors
How to enable:
- PCG:
- Class settings:
Use hierarchical gen
- HiGen Default Grid Size Can be UB - unbounded (3200)
- Class settings:
- PCG component details:
Is Partitioned
- Grid Size
- Set up
partition grid size
in PCG world actor
- Set up
Cavoites
- If leftovers
Tools
>PCG Framework
>Delete all uinbused PCG partition actors
Self
is now partition actor sow will copy created points to center of all partitions (Original
should fix) and then maybe need to resolve intersections
Hierarchical Generation
Allow for referencing points on grid
- PCG -
Graph settings
:Grid Size
node - Gates to force downstream graph in given size.- Can compute on higher and used on lower grid size
- Only smaller (64) grid sizes can use data from bigger (128) high gen default grid size (Bigger Grid size for big / smaller values for grass)
- PCG node -
Grid Size
- [ ] off : Ignore self hits - [ ] collision -PCG Component data
- Get data from offline (select by tag)- Projection to :
World Ray Hit Query
Gather
node - if you want wait for other nodes
- Projection to :
Communicate
Re-use offline computed data in runtime.
Output
Output
node. - everything will be serialized - on pcg component you can findGenerated Graph Output
s
Input
PCG Component data
- use with tag and overlap self
I/O
Save PCG Data Asset
- ExportLevel Instance
to PCG:Asseet Action
>Create PCG Asset From level
. Then drag to PCG Graph (Load PCG Data Asset
)- Add tags to
StaticMeshes
in level instance (ThenRMB
and:update assets
) > Those attributes can be read in PCG and filter byAttributeFilter
#### Offline to Runtime
offline
- Output point with labels
- mesh spawn can modify bounds so sometimes (trees) need to disable modify bounds on static mesh spawner
Dictionary
Get Actor Data
Get Componen by classMerge Attributes
-Save PCG Asset
- Save data to asset BP- spline
- pcg with grammar
- https://youtu.be/j3ke6MmcaeY?t=359
PCG Nodes
Attribute operation
- duplicate attribute with different name- ‘Math’ -
Create Points
You can get points out from spatial data - points, volume, mesh, landscape
Create points Grid
- Create grid of points in 0,0,0.- Grid Extent - wielkość siatki
- Cell size - wielkość
Get Landscape Data
>Surface Sampler
- sample landscape points Landscape is surface >surface is spatial dataGetSplineData
>Spline Sampler
- sample splineMesh Sampler
Mesh to points
- slower than samplerProject Points
Projection
- can project dataFilters Density
White and Black gradient on preview boxes.
Density Filter
- min max on Density (point filter specific version)Density remap
- remapDensity Noise
-Filters
filter data based on criteria or per-point.
Distance
- distance- ?
Point Filter
«< target attribute (simpler version is density filter )- i.e.: by landscape layer
-
Intersection
- Boolean np duize punkty od malych mozna odjąć !!!!!!!!!!!!!!!!!!!! Attribure Filter
- Surface sampler , sample material »> AF:Transform points
Copy Points
- Houdini copy to pointsTransform Points
- transform- to rot up: turn on: absolute rotation
Multiplay
-- Scale : $Scale , $Density , $Scale
Difference
- mozna usunąć nachodzące punkty ale Bounds muszą być ok ! (jak nie to zmien by bounds modifire)! PORÓWNYWANIE CHMURY PUNKTÓW !!!!!!!!!!!!!Select
- can selectLandscape Project
- but reset rotationsSpawner
Green nodes
Static Mesh Spawner
- This node is creating ISM components with resulting geometry. You fire
- can disable just this node for debug.
Get Data
Get Actor Data
- Actor filter: Patent / Root / All World actors (can be slow) /
- Mode: data from property can be used as attribute
Tech
World Ray Hit Quarry
-- can get reference from physical material
Get Actor Property
property to parameter data
- PARAMETERS INPUT FROM BLUEPRINT- self - from actor belong ro pcg «
Blueprint / Control Flow / Debug / Spatial
Optimize
spawnuj rzec zy bez kolizji daleko
Sources
spawn instances Unreal Engine 5 Tutorial - Open World Optimization: Don’t use actors too much Natural scaling density - UnrealityBites Freetime Coder - basics
- overview
- path cut throuy other pcg by tag.
- project gdir spawn points
- subgraphs
- actor and attributes: BP > add PCG component powinno działac
https://youtu.be/nq7aqU2F6mQ?list=PLA03OHAaHgYpo0enf8p-2oEpja3grLOKZ&t=348 - Sampling meshes > copy to points mesh source
- Custom Nodes
- jungle biom Michael Royalty - flowers and bends / loops - triki ale nudnny 1
- Custom data material in spawned elements https://youtu.be/5PM9dq0jWGc?list=PLzvhOHK7paz7EqFQ3SjX0WcJbHYKB-dkw&t=1122
- Position to middle of mesh https://youtu.be/MgXGXg8roUE?list=PLzvhOHK7paz7EqFQ3SjX0WcJbHYKB-dkw&t=99 2
- Water splines https://youtu.be/e7VtqD1L19U?list=PLzvhOHK7paz7EqFQ3SjX0WcJbHYKB-dkw
- PCG World Ray Hit Query https://youtu.be/XiBRJAtHIDk?list=PLA03OHAaHgYpo0enf8p-2oEpja3grLOKZ
UE5.3 PCG - Ep 5 - Parameters and runtime execution https://youtu.be/0NQAQPaJ8ko
srednie Deep Dive into the Electric Dreams Project
Guides
Find Actor
- find actor by tag
Spawn on Landscape
Get Landscape Data
Surface Sampler
Projection
Spawn on Spline
GetSplineData
- can from comonent if added to pcg vpoolume
- can all world actors. - by tag / name / class
Spline Sampler
Spawn on Spline w BP
to jest spawn i jakies dodatkowe bzdurne kopiowanie scien budynku YT
- Create
- BP Actor
- BP Actor of class: PCGBlueprintElement
- CG Graph
- Add spline and pcg to BP as […]
- PCG:
Get spline data
>spline sampler
- now BP should work out of the box - in PCGBlueprintElement > Clas sdetails > Expose to library (of pcg nodes)
Spawn on Surface
`World Ray Hit Querry` > `Surface Sampler` < !!!! spawn on world
To spawno on other spawned
- ignore self hits
- eqxec order << DEPENDENCY (to 2 input of surface sampler)
BP regenerate on demand:
![[Pasted image 20250119071451.png]]