flow nodes

7 node types in the flow category.

foreach#

aliases: for_each loop foreach_piece for_loop

Loop a subgraph over connected pieces, attribute values, points, prims, or N times (with optional feedback).

The body is a nested graph. Inside it, an {"type":"input","params":{"index":0}} node yields the current piece (or the previous iteration's result in feedback mode); index 1 yields the whole input; index 2 the foreach's second input. Vars the body's "=expr" params and code read by their bare name: iteration, numiterations, value (piece attribute value / element number), attr (object of the element's attributes, e.g. attr.height), plus all parent vars. feedback:true is count-based and runs all iterations in one cook at the current time; for feedback over frames use solver.

Inputs

#namedescription
0geogeometry to iterate over (optional for count mode) (optional)
1extraavailable inside the body as input index 2 (optional)

Parameters

nametypedefaultrangedescription
modeenum"pieces"pieces = by piece_attrib (or connectivity); count = N iterations; points/prims = one element each
options: pieces count points prims
piece_attribstring""pieces: prim attribute to group by ("" = connectivity)
countint40..1000000count mode: iterations
feedbackboolfalsecount mode: feed each result into the next iteration (output = last)
bodygraph{nodes, output}subgraph {nodes, output} run per iteration
max_iterationsint100001..1000000safety limit

Example

{
  "type": "foreach",
  "in": ["pieces"],
  "params": {
    "mode": "pieces",
    "body": {
      "nodes": {
        "piece": { "type": "input", "params": { "index": 0 } },
        "lift": {
          "type": "transform",
          "in": ["piece"],
          "params": { "translate": [0, "=iteration * 0.2", 0] }
        }
      },
      "output": "lift"
    }
  }
}

Used in the examples guided_town, market_street, rail_along_curve, scifi_panel, town_from_lots.

graph_ref#

aliases: object_merge reference ref

Use the output (or any node) of another graph in the package — compose scenes from separate graphs.

Inputs

None (generator).

Parameters

nametypedefaultrangedescription
graphstring""package graph name
nodestring""node in that graph ("" = its output)
varsjson{}override that graph's vars

Example

{
  "type": "graph_ref",
  "params": { "graph": "island", "node": "ground", "vars": { "seed": 7 } }
}

input#

aliases: subnet_input loop_input

Inside a subgraph (foreach/solver body or asset): receives the parent input with this index.

Inputs

None (generator).

Parameters

nametypedefaultrangedescription
indexint00..foreach: 0 = current piece/feedback, 1 = whole input, 2 = foreach second input. solver: 0 = previous frame, 1 = initial, 2/3 = extra inputs. assets: input number
labelstring""documentation label for asset inputs

Example

{
  "nodes": {
    "box": { "type": "box", "params": { "divisions": [2, 2, 2] } },
    "each": {
      "type": "foreach",
      "in": ["box"],
      "params": {
        "mode": "prims",
        "body": {
          "nodes": {
            "face": { "type": "input", "params": { "index": 0 } },
            "x": {
              "type": "poly_extrude",
              "in": ["face"],
              "params": { "distance": "=0.05 + iteration * 0.02" }
            }
          },
          "output": "x"
        }
      }
    }
  },
  "output": "each"
}

Used in the examples growth, guided_town, market_street, rail_along_curve, scifi_panel, town_from_lots.

merge#

aliases: combine join

Combine any number of inputs into one geometry (attributes, groups and material tables are unioned).

Material tables are unioned and images (texture nodes) combined. What several inputs share (the same image, the same material) is kept once. A name two inputs use for different things is made distinct, so each piece keeps its own maps and material: package outputs or asset instances whose maps are all called "basecolor" get theirs renamed "<material>_basecolor" (else "basecolor_2" …), different materials of one name "<name>_2", and the input's material table and prim "material" follow. Two different images under one name inside one input are warned about, as texture nodes and materials then cannot tell them apart.

Inputs

#namedescription
0inputsany number of geometries (any number)

Parameters

None.

Example

{
  "nodes": {
    "box": { "type": "box" },
    "ball": { "type": "sphere", "params": { "center": [2, 0, 0] } },
    "both": { "type": "merge", "in": ["box", "ball"] }
  },
  "output": "both"
}

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

null#

aliases: output out passthrough

Pass-through. Use as a named output/marker (e.g. "OUT").

Inputs

#namedescription
0geogeometry (optional)

Parameters

None.

Example

{
  "nodes": {
    "box": { "type": "box" },
    "OUT": { "type": "null", "in": ["box"] }
  },
  "output": "OUT"
}

Used in the examples cloth_drape, fracture_settle, growth, sparks.

solver#

aliases: sop_solver sopsolver

Feedback over frames (Houdini SOP Solver): run a body graph once per frame on the previous frame's result, for growth, accumulation and settling.

Cooking at frame N runs the body for every frame from start_frame to N (once per substep). Inside the body, {"type":"input","params":{"index":0}} is the previous frame's result (the initial geometry on start_frame), index 1 the initial geometry, 2 and 3 the extra inputs cooked at that frame. Before start_frame the initial geometry passes through. The body sees the vars iteration (frames since start_frame, from 0), substep, frame, time and timeInc (the step's time; frames are fractional between substeps), plus parent vars, by their bare name; wrangles also get @Frame @Time @TimeInc. Caching: the state after frame f has the signature S(f) = hash(S(f-1), f, extra-input signatures at f), starting from S(start_frame-1) = hash(params, vars, initial input at start_frame). Every frame's state is cached under S(f), so cooking frame 11 after frame 10 runs the body once, and going back to an earlier frame is a cache hit. foreach with feedback:true is different: it is count-based (N iterations in one cook, no notion of time) and is cached as a whole.

Inputs

#namedescription
0initialgeometry the solve starts from (cooked at start_frame)
1extra1available in the body as input 2, cooked at each simulated frame (optional)
2extra2available in the body as input 3, cooked at each simulated frame (optional)

Parameters

nametypedefaultrangedescription
bodygraph{nodes, output}subgraph {nodes, output} run per frame (and substep): input 0 = previous frame, 1 = initial, 2/3 = extra inputs (default: pass through)
start_frameint1first frame the body runs on; earlier frames output the initial geometry
substepsint11..1000body runs per frame; timeInc = 1 / (fps * substeps)
max_framesint10001..1000000safety limit: most frames simulated from start_frame

Example

{
  "type": "solver",
  "in": ["seed"],
  "params": {
    "body": {
      "nodes": {
        "prev": { "type": "input", "params": { "index": 0 } },
        "grow": {
          "type": "poly_extrude",
          "in": ["prev"],
          "params": { "group": "@N.y>0.9", "distance": 0.1 }
        }
      },
      "output": "grow"
    }
  }
}

Used in the example growth.

switch#

Pass through one of several inputs by index (use "=expr" to drive it from vars).

Inputs

#namedescription
0inputscandidate geometries (any number)

Parameters

nametypedefaultrangedescription
indexint0which input to output (clamped)
aliases: input

Example

{
  "vars": { "variant": 1 },
  "nodes": {
    "box": { "type": "box" },
    "ball": { "type": "sphere" },
    "pick": {
      "type": "switch",
      "in": ["box", "ball"],
      "params": { "index": "=variant" }
    }
  },
  "output": "pick"
}

Used in the examples asset_cleanup, lsystem_tree, machined_bracket, market_street, rail_along_curve, scifi_panel, unreal_landscape.