measure nodes

4 node types in the measure category.

assert#

aliases: expect check verify

Check the geometry (watertight, counts, bbox, edge lengths, degenerate faces, self-intersections, UV overlaps, attributes, groups, an expression, heightfields, image sizes, layers and values) and fail, warn or mark when a check fails. Passes the geometry through.

Every check is off by default; enable the ones that express what the graph must produce. on_fail error makes the node (and the graph) fail with one message listing each failed check and the measured value, so a build or edit reports a broken invariant right away. warn passes through with that message as a warning. mark passes through and writes detail assert_failed (number of failed checks) and assert_report (the message), plus point / prim groups assert_fail on the offending elements where a check can localise them (render {highlight:"assert_fail"}). expr is a JS expression over npoints nprims nvertices npolys nlines bbox (.min .max .size .center, each with .x .y .z) volume area pieces open_pieces genus closed boundary_edges, also under geo (geo.pieces), and the graph vars by their bare name (as in every expression a var comes first: with a var "pieces", pieces is the var and geo.pieces the measurement). Heightfields and images (which have no points) have checks of their own: heightfields / images name the ones that must exist, and the checks after each read those (every one when the name is empty): samples, height_min / height_max and match for heightfields (match compares with the heightfield of the reference input at the same world X and Z: a tile cooked on its own against its map, along its edges or everywhere), image_size, image_layers and image_min / image_max (every channel of every layer) for images. Each cook records stats checks and failed.

Inputs

#namedescription
0geogeometry to check (passed through)
1referenceoptional: geometry with the heightfield match compares against (optional)

Parameters

nametypedefaultrangedescription
on_failenum"error"error = fail the node; warn = pass through with a warning; mark = pass through and write assert_failed / assert_report / group assert_fail
options: error warn mark
aliases: onfail action
labelstring""what this assert guards, prefixed to the message
aliases: message msg
watertightboolfalseclosed surface: only polygons, every edge shared by exactly two of them. Geometry with no primitives passes.
aliases: closed
manifoldboolfalseno edge shared by 3+ polygons and no bowtie points (fans touching at a point)
no_flippedboolfalseneighbouring polygons wound consistently, and closed pieces face outward (positive volume; the walls of a cavity inside a hollow solid may face inward)
aliases: outward consistent_winding
min_pointsint-1-1..2147483647at least this many points (-1 = off)
max_pointsint-1-1..2147483647at most this many points (-1 = off)
min_primsint-1-1..2147483647at least this many prims (-1 = off)
max_primsint-1-1..2147483647at most this many prims (-1 = off)
bbox_minjsonnull[x, y, z] (or one number): no point may lie below it (null = off)
bbox_maxjsonnull[x, y, z] (or one number): no point may lie above it (null = off)
min_edge_lengthfloat00..no edge shorter than this (0 = off)
no_degenerateboolfalseno zero-area polygons (area <= tolerance²) and no two points within tolerance of each other
no_self_intersectionsboolfalseno two non-adjacent triangles cross each other (BVH search, capped at max_tests)
aliases: no_intersections
strict_intersectionsboolfalseno_self_intersections also fails on touching contacts, coplanar overlaps and triangles folding through a shared corner or onto a shared edge
aliases: strict
max_testsint20000001000..1000000000self-intersections: candidate triangle pairs to test before stopping (the message says when it stopped) (advanced)
uv_overlapsjsonnullat most this many overlapping UV triangle pairs, counted both within and across islands defined by UV continuity as in uv_layout (null = off)
uv_attribstring"uv"point or vertex UV attribute to check for overlaps
attribstring""attribute that must exist ("" = off)
aliases: attribute
attrib_classenum"auto"where attrib must live (auto = any class: vertex, point, prim, detail)
options: auto point vertex prim detail
attrib_minjsonnullattrib: smallest allowed value of every component (null = off)
attrib_maxjsonnullattrib: largest allowed value of every component (null = off)
groupstring""group name (any class) that must exist and be non-empty ("" = off)
exprcode""JS expression that must be true ("" = off) over npoints nprims nvertices npolys nlines bbox (.min .max .size .center, each with .x .y .z) volume area pieces open_pieces genus closed boundary_edges, also under geo (geo.pieces), and the graph vars by their bare name (as in every expression a var comes first: with a var "pieces", pieces is the var and geo.pieces the measurement); e.g. "volume > 1 && pieces == 1"
aliases: expression condition
tolerancefloat0.0000010..distance tolerance for bbox_min/max and duplicate points (advanced)
heightfieldsstring""heightfield names that must exist (space-separated, * wildcards, ^name excludes; "" = off); the heightfield checks read these, or every heightfield when empty
aliases: heightfield
samplesjsonnull[x, z] samples (or one number for both) every heightfield checked must have, e.g. an Unreal Landscape size (null = off)
height_minjsonnullno height sample of a heightfield checked may lie below this (null = off)
height_maxjsonnullno height sample of a heightfield checked may lie above this (null = off)
matchenum"off"compare every heightfield checked with the first heightfield of input 1 at the same world X and Z: edges = its border samples (tiles join without seams), all = every sample
options: off edges all
match_tolerancefloat0.00010..match: largest height difference allowed (m) (advanced)
imagesstring""image names that must exist (space-separated, * wildcards, ^name excludes; "" = off); the image checks read these, or every image when empty
aliases: image
image_sizejsonnull[width, height] in pixels (or one number for both) every image checked must have (null = off)
image_layersstring""every image checked must have a layer matching each space-separated name or * pattern ("" = off)
image_minjsonnullno channel value of an image checked may lie below this, in any layer; NaN fails (null = off)
image_maxjsonnullno channel value of an image checked may lie above this, in any layer; NaN fails (null = off)

Writes: passes geometry through; mark: detail int assert_failed, detail string assert_report, point/prim group assert_fail

Example

{
  "nodes": {
    "body": {
      "type": "box",
      "params": { "size": [1, 2, 1], "center": [0, 1, 0] }
    },
    "check": {
      "type": "assert",
      "in": ["body"],
      "params": {
        "watertight": true,
        "no_flipped": true,
        "bbox_min": [-1, 0, -1],
        "bbox_max": [1, 2.5, 1],
        "expr": "volume > 1.5 && pieces == 1"
      }
    }
  },
  "output": "check"
}

Used in the examples asset_cleanup, blob_creature, cloth_drape, corridor_panels, eroded_valley, forest_on_terrain, fracture_settle, growth, guided_town, image_cutouts, lsystem_tree, machined_bracket, market_street, material_set, ocean_surface, rail_along_curve, rusty_drum, scifi_panel, sparks, stair_flight, terrain_tiles, town_from_lots, unreal_landscape, weathered_cabinet, worn_machine.

curvature#

aliases: measure_curvature

Per-point discrete curvature of a polygon mesh: mean, Gaussian, principal min/max or convexity.

mean: signed mean curvature in 1/m from the cotangent Laplacian over the mixed Voronoi area (1 on a unit sphere, positive where the surface bulges along its normals, negative in creases). gaussian: angle deficit over the mixed area in 1/m² (positive on domes and bowls, negative on saddles). principal_min/max: H ∓ √(H² − K). convexity: sign of the mean curvature (1 convex, -1 concave, 0 flat). n-gons are measured through their triangulation. Boundary and non-manifold points take the value of the nearest interior point (a warning says how many). Typical use: colour or mask by curvature (wear on convex edges, dirt in concave creases).

Inputs

#namedescription
0geopolygon mesh

Parameters

nametypedefaultrangedescription
typeenum"mean"which curvature to write
options: mean gaussian principal_min principal_max convexity
aliases: curvature_type mode
smooth_iterationsint00..200Laplacian smoothing passes over the values (not the geometry)
aliases: smooth blur
normalizeboolfalsefit the values to 0..1 between the clip_percent and 100 - clip_percent percentiles (constant values become 0.5)
aliases: fit
clip_percentfloat20..49normalize: percent of values clamped at each end before fitting (ignores spikes)
namestring"curvature"output point attribute (float)
aliases: attrib attribute

Writes: point float <name> (default "curvature")

Example

{
  "nodes": {
    "ball": { "type": "sphere", "params": { "type": "ico", "level": 4 } },
    "rough": {
      "type": "noise_displace",
      "in": ["ball"],
      "params": { "amplitude": 0.25, "frequency": 2 }
    },
    "k": {
      "type": "curvature",
      "in": ["rough"],
      "params": { "type": "mean", "smooth_iterations": 2, "normalize": true }
    },
    "out": {
      "type": "color",
      "in": ["k"],
      "params": { "mode": "ramp", "attrib": "curvature", "range": [0, 1] }
    }
  },
  "output": "out"
}

distance#

aliases: measure_distance xyzdist

Distance from each point to a target: mesh surface (BVH), polylines, or points (KD-tree); optionally signed and with the nearest prim, uv and position.

The target (second input) is measured as polygons (closest point on the surface), polylines (closest point on the segments) and, when it has no prims at all, its points. signed makes points inside a closed target negative (ray-parity inside test). extra also writes nearest_prim (int, -1 = none), nearest_uv (prim uv: triangle barycentrics like Houdini primuv, quad bilinear, polyline u 0..1) and nearest_P. Points farther than max_distance get max_distance and nearest_prim -1 (Houdini xyzdist with a max distance).

Inputs

#namedescription
0geopoints to measure from
1targetgeometry to measure to (mesh, curves or points)

Parameters

nametypedefaultrangedescription
signedboolfalsenegative inside a closed polygon target
max_distancefloat00..search radius (0 = unlimited); points beyond it get this value
aliases: maxdist radius
extraboolfalsealso write nearest_prim, nearest_uv and nearest_P
groupgroup (point)""points to measure ("" = all); the others keep their values
namestring"dist"output point attribute (float)
aliases: attrib attribute

Writes: point float dist (or <name>); with extra: int nearest_prim, vec3 nearest_uv, vec3 nearest_P

Example

{
  "nodes": {
    "ground": {
      "type": "grid",
      "params": { "size": [6, 6], "divisions": [60, 60] }
    },
    "path": {
      "type": "curve",
      "params": {
        "points": [[-3, 0, -2], [-1, 0, 1], [1, 0, -1], [3, 0, 2]],
        "smooth": true
      }
    },
    "d": { "type": "distance", "in": ["ground", "path"] },
    "out": {
      "type": "color",
      "in": ["d"],
      "params": { "mode": "ramp", "attrib": "dist", "range": [0, 1.5] }
    }
  },
  "output": "out"
}

Used in the example guided_town.

occlusion#

aliases: ambient_occlusion ao thickness

Ray-cast per-point measures: ambient occlusion (0 open … 1 enclosed), thickness in metres, or cavity (0..1).

Casts samples stratified, seeded, cosine-weighted rays per point inside a cone around the point normal and tests them against the geometry itself plus the optional occluder input (a triangle BVH). occlusion → "ao": fraction of rays blocked within max_distance. cavity → "cavity": occlusion over a short range where near walls count most (crevices and inner corners light up, flat and convex areas are 0). thickness → "thickness": mean distance to the opposite wall along rays cast inward (against the normal) in metres, so it needs closed or double-walled geometry with outward normals; normalize divides by max_distance. The alias "thickness" still defaults to mode occlusion: set mode. class prim measures each polygon instead of each point: face_points points spread over it (more on large faces, by area) cast the rays along the polygon normal, and the mean of them is written as a prim attribute, so a large face that is half covered reads half enclosed where its corner points would read open. Points (or prims) outside group keep their values.

Inputs

#namedescription
0geopoints to measure (normals from N, else computed from the polygons)
1occluderextra geometry the rays can hit (e.g. the ground under scattered rocks) (optional)

Parameters

nametypedefaultrangedescription
modeenum"occlusion"what to measure
options: occlusion thickness cavity
classenum"point"point = one value per point (rays along the point normal); prim = one value per polygon, the mean over face_points points spread over it (rays along its normal)
options: point prim
face_pointsint81..256class prim: points per polygon, at least (large polygons get one per 0.002 m², up to 256)
samplesint321..1024rays per point (stratified; more = smoother)
aliases: rays count
max_distancefloat00..hits farther than this are ignored; 0 = auto (occlusion: unlimited, cavity: 5% of the scene diagonal, thickness: the scene diagonal)
aliases: maxdist distance radius
biasfloat00..ray start offset along the normal against self-hits; 0 = auto (1e-4 of the scene diagonal)
cone_anglefloat00..90half-angle of the ray cone in degrees; 0 = auto (90 = hemisphere for occlusion and cavity, 15 for thickness: a slab reads within 2%)
aliases: angle spread
seedfloat0random seed
invertboolfalsewrite 1 - value (thickness: max_distance - value), e.g. exposure instead of occlusion
normalizeboolfalsethickness: divide by max_distance to get 0..1 (occlusion and cavity are always 0..1)
groupgroup (point)""points (class point) or prims (class prim) to measure ("" = all); the others keep their values
namestring""output attribute ("" = ao, thickness or cavity by mode)
aliases: attrib attribute

Writes: point float ao | thickness | cavity (or <name>); class prim: the same as a prim attribute

Example

{
  "nodes": {
    "rock": { "type": "sphere", "params": { "type": "ico", "level": 4 } },
    "shape": {
      "type": "noise_displace",
      "in": ["rock"],
      "params": { "amplitude": 0.35, "frequency": 1.6 }
    },
    "ao": { "type": "occlusion", "in": ["shape"], "params": { "samples": 32 } },
    "out": {
      "type": "color",
      "in": ["ao"],
      "params": {
        "mode": "ramp",
        "attrib": "ao",
        "range": [0, 1],
        "ramp": [[0, "#f2e6d0"], [1, "#2b2118"]]
      }
    }
  },
  "output": "out"
}