pcg nodes
6 node types in the pcg category.
attribute_from_map#
aliases: attribfrommap attrib_from_image texture_to_attrib attrib_from_map attribute_from_image texture_sample
Sample a PNG image (8/16-bit grey or RGB(A)) into a point attribute by uv or by a planar projection (xz ground maps, xy/yz walls): density maps, masks, colour.
Houdini: Attribute from Map; Unreal PCG: Get Texture Data + Sample Texture. projection uv reads the uv attribute (point or vertex; GPU convention: pixel centres at (i + 0.5) / width, v = 0 at the bottom of the image unless flip_v). Planar projections map the image onto a size × size rectangle around center with the first and last pixels on its edges (the layout heightfield_from_image and export png16/mask_png use): xz = top view, column along +X, row 0 at min Z; xy = facing +Z, column along +X, row 0 at max Y; yz = facing +X, column along −Z, row 0 at max Y. channel luminance (Rec. 709), r, g, b, a or rgb (a vector); remap maps black..white to remap[0]..remap[1]. Bilinear or nearest filtering; wrap repeat, clamp or mirror outside the image. class vertex writes per vertex (uv seams stay sharp); point averages a point's vertices when uv is a vertex attribute. The file is re-read when it changes.
Inputs
| # | name | description |
|---|---|---|
| 0 | geo | points or mesh |
Parameters
| name | type | default | range | description |
|---|---|---|---|---|
path | path | "" | PNG file or URL; a relative path reads from the package folder (nearest .topo file), else the graph's folder aliases: file filename map texture image | |
name | string | "" | output attribute ("" = Cd for channel rgb, else mask) aliases: attrib attribute output | |
channel | enum | "luminance" | which channel (rgb writes a vector) options: luminance r g b a rgb | |
projection | enum | "uv" | uv attribute or a planar projection (xz = top view) options: uv xz xy yzaliases: mapping | |
uv_attrib | string | "uv" | projection uv: the uv attribute (vertex or point) | |
size | vec2 | [10,10] | planar: extent of the image in metres (columns, rows) | |
center | vec3 | [0,0,0] | planar: centre of the image rectangle aliases: t translate origin | |
remap | vec2 | [0,1] | output value for black and for white aliases: range | |
wrap | enum | "clamp" | outside the image: clamp to the edge, tile, or mirror options: clamp repeat mirror | |
filter | enum | "bilinear" | pixel interpolation options: bilinear nearestaliases: interpolation | |
flip_v | bool | false | flip the image vertically | |
class | enum | "point" | write a point attribute or a vertex attribute options: point vertex | |
group | group (point) | "" | points to write ("" = all) |
Writes: point (or vertex) float <name> (vec3 for channel rgb)
Example
{
"type": "attribute_from_map",
"in": ["ground_pts"],
"params": {
"path": "density.png",
"projection": "xz",
"size": [100, 100],
"name": "density"
}
}
cluster#
aliases: pcg_cluster kmeans clusterpoints cluster_points
Cluster points: k-means (count clusters) or by radius; writes an int cluster id (optionally the cluster centre and a debug colour). Piece assignment, grouping scattered objects, LOD cells.
Houdini: Cluster Points SOP (k-means, attribute "cluster"); Unreal PCG: no direct node (use cluster ids with Attribute Partition). kmeans: seeded k-means++ start, then Lloyd iterations (stops when nothing changes); radius: leader clustering, points visited in a seeded random order take every unassigned point within radius, so each cluster fits in a ball of that radius. Cluster ids are numbered in point order (cluster 0 holds the first point). center writes cluster_center (the centroid of the cluster); color writes Cd per cluster for a debug render. Points outside group get cluster -1. Packed instances are clustered by their anchors.
Inputs
| # | name | description |
|---|---|---|
| 0 | points | points (or any geometry: its points are clustered) |
Parameters
| name | type | default | range | description |
|---|---|---|---|---|
method | enum | "kmeans" | k-means with count clusters, or radius clusters options: kmeans radiusaliases: mode | |
count | int | 8 | 1..100000 | kmeans: number of clusters aliases: clusters k num_clusters |
iterations | int | 10 | 1..1000 | kmeans: Lloyd iterations at most aliases: iter |
radius | float | 1 | 0.. | radius: cluster radius in metres |
seed | float | 0 | random seed | |
name | string | "cluster" | output point int attribute aliases: attrib output | |
center | bool | false | also write cluster_center (vec3) aliases: write_center cluster_center | |
color | bool | false | also write Cd per cluster (debug view) aliases: colorize visualize | |
group | group (point) | "" | points to cluster ("" = all); the others get -1 |
Writes: point int cluster (or <name>); optional cluster_center, Cd
Example
{
"nodes": {
"g": { "type": "grid", "params": { "size": [20, 20] } },
"s": { "type": "scatter", "in": ["g"], "params": { "count": 400 } },
"c": {
"type": "cluster",
"in": ["s"],
"params": { "count": 6, "color": true }
}
},
"output": "c"
}
mask#
aliases: pcg_mask scatter_mask mask_by_feature maskbyfeature point_mask
Write a 0..1 point mask from a feature (slope, height, curvature, occlusion, distance, direction, noise, attribute, group, inside), shaped by a band with falloff and a ramp, and combined with an existing mask. Feed scatter density_mask or prune.
Houdini: Mask by Feature / attribute from features; Unreal PCG: Density Filter inputs (Normal To Density, Distance, Spatial Noise). The feature value v becomes 1 inside [min, max] and fades linearly to 0 over falloff outside it (a hard edge when falloff is 0), then ramp reshapes it, invert flips it, and combine merges it with the existing mask attribute (replace, multiply = and, max = or, add, subtract, min). Units of min/max per feature: slope = degrees between N and up (0 flat, 90 vertical; default 0..30 = gentle ground); height = metres along up (Y); curvature = mean curvature in 1/m (positive convex: ridges, bumps; negative concave: valleys); occlusion = 0..1 ambient occlusion (rays against the geometry and input 1); distance = metres to input 1 (mesh, curves or points; e.g. away from a road: min 3, max 1e9); direction = degrees between N and direction (e.g. north faces); noise = 0..1 fractal noise (frequency, octaves, seed); attribute = the value of source_attrib (first component); group = 1 for points matching pattern; inside = 1 inside input 1's closed mesh (falloff = soft edge in metres outside it). Normals: the point N, else for a point cloud the normal of input 1 at the closest point, else computed from the polygons. Packed instances keep their anchors.
Inputs
| # | name | description |
|---|---|---|
| 0 | geo | points or mesh to mask (the mask is a point attribute) |
| 1 | reference | distance / inside: what to measure to; slope, direction, curvature, occlusion of a point cloud: the surface it lies on (optional) |
Parameters
| name | type | default | range | description |
|---|---|---|---|---|
by | enum | "slope" | feature to mask by options: slope height curvature occlusion distance direction noise attribute group insidealiases: feature type | |
min | float | 0 | lowest feature value with mask 1 (units depend on by)aliases: min_value low | |
max | float | 30 | highest feature value with mask 1 aliases: max_value high | |
falloff | float | 0 | 0.. | linear fade outside [min, max] in feature units (inside: metres outside the mesh); 0 = hard edge aliases: fade soft |
ramp | ramp | [[0,0],[1,1]] | reshape the 0..1 mask before combining | |
invert | bool | false | invert the feature mask (1 - mask) before combining | |
combine | enum | "replace" | merge with the existing mask attribute: multiply = and, max = or (missing attribute = start from scratch) options: replace multiply add subtract max minaliases: mode operation blend | |
name | string | "mask" | output point float attribute aliases: output output_attrib mask_name | |
up | vec3 | [0,1,0] | slope: the "flat" normal; height: the axis heights are measured along aliases: up_vector axis | |
direction | vec3 | [1,0,0] | direction: the facing direction measured against N (angle in degrees) aliases: facing | |
source_attrib | string | "" | attribute: the point attribute to read (vectors: first component) aliases: from_attrib input_attrib feature_attrib | |
pattern | group (point) | "" | group: point group pattern that gets 1 (e.g. "top", "@P.y>2") | |
frequency | float | 0.2 | 0.. | noise: spatial frequency (1/m) aliases: freq |
octaves | int | 3 | 1..8 | noise: fractal octaves |
samples | int | 16 | 1..256 | occlusion: rays per point aliases: rays |
max_distance | float | 0 | 0.. | occlusion: rays only count hits closer than this (0 = unlimited) aliases: radius maxdist |
seed | float | 0 | random seed | |
group | group (point) | "" | points to write ("" = all); the others keep their mask (0 when new) |
Writes: point float mask (or <name>)
Example
{
"nodes": {
"land": { "type": "terrain", "params": { "size": [60, 60], "height": 8 } },
"flat": {
"type": "mask",
"in": ["land"],
"params": { "by": "slope", "min": 0, "max": 20, "falloff": 10 }
},
"low": {
"type": "mask",
"in": ["flat"],
"params": {
"by": "height",
"min": -100,
"max": 4,
"falloff": 1,
"combine": "multiply"
}
},
"pts": {
"type": "scatter",
"in": ["low"],
"params": {
"generate_by": "density",
"density": 0.5,
"density_mask": "mask"
}
}
},
"output": "pts"
}
orient#
aliases: pcg_orient align orient_points transform_points
Orient points for instancing: write orient (quaternion), N and up from the point normal + up, a surface (input 1), the nearest curve tangent (RMF), a fixed direction, a look-at target or random rotations; plus random yaw, tilt and scale ranges.
Houdini: Attribute Randomize (orient, pscale) + Orient Along Curve + Scatter and Align; Unreal PCG: Transform Points (rotation and scale ranges). Frame convention as copy_to_points: +Z = N, +Y = up. mode gives the main direction: normal_up = the point N (and the point up, else the up param); surface = the normal of input 1 (or of the input's own polygons) at the closest point (snap moves the points onto it); curve_tangent = the tangent of the closest curve of input 1 (or of the input's own curves) with a rotation-minimising up; direction = the direction param; look_at = towards target; random = a random rotation of up to max_angle about axis ([0,0,0] = any axis) applied to the normal_up frame. align_axis z (default) puts the main direction on +Z (N) and makes the up param perpendicular for +Y; align_axis y puts it on +Y (upright models such as trees, rocks or posts follow the surface) and takes +Z from the direction param (the up param in direction mode). upright keeps +Y on the up param and only turns the heading (posts along a sloped road). Then random_yaw turns about the instance's +Y and tilt leans it by an angle in the range towards a random side (degrees). Scale: scale_min..scale_max, random per point or picked by scale_attrib (0..1, e.g. a mask): uniform → pscale, per axis → scale. Points outside group keep their attributes.
Inputs
| # | name | description |
|---|---|---|
| 0 | points | points to orient |
| 1 | reference | surface (mode surface) or curves (mode curve_tangent) (optional) |
Parameters
| name | type | default | range | description |
|---|---|---|---|---|
mode | enum | "normal_up" | where the main direction comes from options: normal_up surface curve_tangent direction random look_at | |
align_axis | enum | "z" | instance axis that follows the main direction: z = N (Houdini copy), y = up (upright models) options: z yaliases: axis_mode align_to | |
up | vec3 | [0,1,0] | reference up (+Y) when the main direction drives +Z aliases: up_vector | |
direction | vec3 | [0,0,1] | mode direction: the main direction; align_axis y: the reference for +Z aliases: dir heading | |
target | vec3 | [0,0,0] | look_at: the point instances face aliases: look_at_point | |
axis | vec3 | [0,1,0] | random: rotation axis ([0,0,0] = a random axis per point) | |
max_angle | float | 180 | 0..180 | random: largest rotation in degrees (either way) |
random_yaw | vec2 | [0,0] | random turn about the instance up axis, degrees [min, max] (e.g. [0, 360]) aliases: yaw random_heading rotation_range | |
tilt | vec2 | [0,0] | random lean away from up, degrees [min, max], towards a random side aliases: random_tilt lean | |
scale_min | vec3 | [1,1,1] | smallest scale (a number for all axes) aliases: min_scale | |
scale_max | vec3 | [1,1,1] | largest scale aliases: max_scale | |
uniform_scale | bool | true | one random factor (x component of the range) → pscale; off: per-axis factors → scale | |
scale_attrib | string | "" | point attribute 0..1 picking the scale between min and max instead of a random value (a scale ramp by mask) | |
upright | bool | false | keep +Y on the up param: only the heading (+Z projected onto the horizontal plane) follows the mode (lamp posts on a sloped road, buildings) aliases: keep_upright yaw_only | |
snap | bool | false | surface: move the points onto the surface | |
write | enum | "both" | attributes to write: orient + N + up, only orient, or only N + up options: both orient n_up | |
seed | float | 0 | random seed | |
group | group (point) | "" | points to orient ("" = all) |
Writes: point orient (quaternion), N, up; pscale or scale when a scale range is set
Example
{
"nodes": {
"ground": { "type": "grid", "params": { "size": [20, 20] } },
"pts": { "type": "scatter", "in": ["ground"], "params": { "count": 200 } },
"o": {
"type": "orient",
"in": ["pts"],
"params": {
"mode": "direction",
"align_axis": "z",
"random_yaw": [0, 360],
"tilt": [0, 8],
"scale_min": 0.7,
"scale_max": 1.3
}
}
},
"output": "o"
}
Used in the example guided_town.
points_along_curve#
aliases: pcg_spline_sampler curve_points spline_sampler points_along_spline sample_curve
Points along curves at a spacing (metres, with start/end offsets), a count, per segment or at the curve points; writes curveu, tangent, N, up (rotation-minimising), orient and curve_id. Lamp posts, fence posts, road markings.
Houdini: Resample (+ Orient Along Curve) to points; Unreal PCG: Spline Sampler (distance / subdivision modes). mode distance: points every spacing metres of arc length from start_offset to the curve length − end_offset (count > 0 instead spreads exactly count points evenly over that range); subdivision: per_segment points on every segment (the vertices and evenly between them); at_points: one point per curve vertex. jitter moves points randomly by up to ±jitter metres along the curve. side_offset shifts them sideways (positive = right of the direction of travel, T × up), both_sides adds the mirrored point on the left (side = -1). Attributes: curveu (0..1 of the arc length), tangent = N (unit, along the curve), up (rotation-minimising frame starting from the up param), orient (+Z along the curve), curve_id (source prim); source point attributes are interpolated and prim attributes copied. Closed curves (polygons) are walked as loops.
Inputs
| # | name | description |
|---|---|---|
| 0 | curves | polylines or polygons (outlines); Bezier/NURBS curves are sampled adaptively |
Parameters
| name | type | default | range | description |
|---|---|---|---|---|
mode | enum | "distance" | distance = by spacing (or count); subdivision = per segment; at_points = the curve vertices options: distance subdivision at_points | |
spacing | float | 1 | 0.0001.. | distance: metres of arc length between points aliases: step length seglen distance |
count | int | 0 | 0..5000000 | distance: exactly this many points per curve, evenly spread (0 = use spacing) aliases: npts points |
per_segment | int | 1 | 1..10000 | subdivision: points per segment aliases: segments subdivisions |
start_offset | float | 0 | 0.. | skip this many metres at the start aliases: start |
end_offset | float | 0 | 0.. | skip this many metres at the end aliases: end |
jitter | float | 0 | 0.. | random move along the curve, metres (±) |
side_offset | float | 0 | sideways offset in metres (positive = right of the direction of travel) aliases: offset lateral_offset | |
both_sides | bool | false | also place the mirrored point on the other side (side_offset ≠ 0) | |
up | vec3 | [0,1,0] | up vector the rotation-minimising frame starts from aliases: up_vector | |
seed | float | 0 | random seed | |
group | group (prim) | "" | curves to sample ("" = all) |
Writes: points: curveu, tangent, N, up, orient, curve_id (side with a side offset); source point/prim attributes
Example
{
"nodes": {
"road": {
"type": "curve",
"params": {
"points": [[-20, 0, -5], [0, 0, 5], [20, 0, 0]],
"smooth": true
}
},
"lamps": {
"type": "points_along_curve",
"in": ["road"],
"params": {
"spacing": 8,
"start_offset": 2,
"side_offset": 4,
"both_sides": true
}
}
},
"output": "lamps"
}
Used in the examples guided_town, market_street, rail_along_curve.
prune#
aliases: pcg_prune self_prune bounds_prune density_filter self_pruning point_filter
Remove points: overlapping spheres (pscale × radius; largest or random wins), a random fraction by a mask (density filter), an attribute expression (@mask<0.5), or points near / inside other geometry (input 1).
Unreal PCG: Self Pruning (overlap), Density Filter (density), Attribute Filter (expression), Difference / Bounds Modifier (near_geometry); Houdini: Delete by expression, Fuse/Scatter relax. overlap: each point is a sphere of radius × pscale (radius alone without use_pscale or pscale); spheres are kept in priority order (largest first, smallest first, random, point order, or by priority_attrib, highest first) and any sphere overlapping a kept one is removed, so no two kept spheres overlap (exact). density: keep each point with probability attrib × fraction (seeded; a missing attrib counts as 1). expression: remove points matching a point group pattern (@mask<0.5, "@P.y>3 @height<0.2" = either, "!top"). near_geometry: remove points within distance of input 1 (mesh surface, curves or points) and, with inside, points inside its closed polygons (e.g. buildings, roads). invert keeps what would be removed. Points outside group are kept and do not take part. Removing a point removes the prims using it; packed instances go with their anchor points.
Inputs
| # | name | description |
|---|---|---|
| 0 | points | points to prune |
| 1 | blocker | near_geometry: the geometry points must keep away from (optional) |
Parameters
| name | type | default | range | description |
|---|---|---|---|---|
mode | enum | "overlap" | how to choose the points to remove options: overlap density expression near_geometry | |
radius | float | 0.5 | 0.. | overlap: sphere radius in metres (times pscale) aliases: rad bounds_radius |
use_pscale | bool | true | overlap: multiply radius by the point pscale | |
priority | enum | "largest" | overlap: which sphere wins (ties are broken randomly) options: largest smallest random order attribute | |
priority_attrib | string | "" | overlap, priority attribute: point attribute, highest value wins | |
attrib | string | "mask" | density: keep probability attribute (0..1) aliases: density_attrib mask_attrib | |
fraction | float | 1 | 0.. | density: multiplies the keep probability (0.3 = keep about 30% where the mask is 1) aliases: keep_fraction ratio |
expression | string | "@mask<0.5" | expression: point group pattern of the points to remove aliases: expr filter | |
distance | float | 1 | 0.. | near_geometry: remove points closer than this to input 1 (metres) aliases: dist clearance |
inside | bool | true | near_geometry: also remove points inside input 1's closed polygons | |
invert | bool | false | keep the points that would be removed instead | |
seed | float | 0 | random seed | |
group | group (point) | "" | points to test ("" = all); the others are kept |
Writes: the kept points (and the prims whose points all survive)
Example
{
"nodes": {
"g": { "type": "grid", "params": { "size": [10, 10] } },
"s": {
"type": "scatter",
"in": ["g"],
"params": { "count": 300, "relax": false }
},
"o": {
"type": "orient",
"in": ["s"],
"params": { "mode": "direction", "scale_min": 0.5, "scale_max": 1.5 }
},
"p": {
"type": "prune",
"in": ["o"],
"params": { "mode": "overlap", "radius": 0.3 }
}
},
"output": "p"
}
Used in the examples guided_town, market_street.