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:
- Tags
- PCG > Utilities > Actor Tagger > EUW_Actor_Tagger
- Partition PCG on grid
- Subgraphs - don’t duplicate Use graph inside other graph
- Data Assets » struct (with mesh information )
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)/2Partition
Checkbox but sometimes can duplicate points
Hierarchical Generation
Work nice when combined with Runtime gen
high gen default grid size
Grid Size
- Gates to force downstream graph in given size
Only smaller (64) grid sizes can use data from bigger (128)
Runtime
PCG:
- Class settings:
Use hierarchical gen
PCG or world: Generation tirgger
- Generate on Runtime- [v] Is Partitioned PCG World Actor:
- [v] Treats editor viewport as generation source.
Use Hierarchical generation
- Treat editor vieport cam as runetime
- Override radi - to change distance
Dependencies
Gather
node - if you want wait for other nodes
I/O
Save PCG Data Asset
- Export
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 runtime
PCG Component data
- Get data from offline (select by tag)Grid Size
Modules
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ąć !!!!!!!!!!!!!!!!!!!!
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
Shortcuts
A
- Attributes
D
- Debug
E
- Enable
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]]