Wrangle

Advanced VEX interface for Natsura. Lets you emit attributes, define gates, or prototype effectors directly into the Apex graph, while respecting the deferred growth model.

Wrangle

The Wrangle wrapper provides an advanced VEX interface into Natsura’s procedural graph.
It evaluates deferred during simulation, so you operate on active growth tips rather than raw geometry.

Use it to:

  • Emit attributes for mappings, gates, and effectors.
  • Create custom rules for pruning, bending, or branching.
  • Ingest external Houdini geometry or volumes as growth drivers.
  • Access the evolving skeleton for self-avoidance or age-based logic.

Unlike Wrangle Core, the wrapper integrates with mappings and effectors and is designed for production use by advanced artists.


Concept

  • Wrangle operates at the graph level, not directly on SOP geometry.
  • Attributes flow upstream: values you assign here are available to parent nodes and sockets.
  • By modifying P, N, and up, you influence tip position/orientation, and those transforms propagate to child growth automatically.
  • It should be used to emit attributes consumed by Natsura (mappings, effectors, gates)—not to author arbitrary Houdini geometry.

Inputs

Input 0 — Graph
The Apex graph under construction. Wrangle runs on the active tips.

Input 1 — Skeleton (optional)
The full simulated skeleton, if enabled. Useful for nearpoint queries against older branches.

int near[] = nearpoints(1, @P, 0.3, 10);

Input 2+ — Houdini Geometry (optional)
Any standard geometry/volumes from SOPs. Use to query environment context:

float d = volumesample(2, "density", @P);

Output — Graph
The modified Apex graph, attributes intact for later Simulate.


Parameters

  • Graph Snippet (graph_snippet)
    VEX code block, evaluated on growth tips at simulation time.
  • Graph Attributes (graph_attributes_fd)
    Multiparm for registering new attributes to Natsura’s mapping system. Attributes declared here are exposed to sockets, ramps, and effectors.
  • Use Simulation Output as Input 1 (connect_main)
    When enabled, Input 1 automatically contains the entire simulated skeleton.

Attributes

Wrangle sees all built-in Natsura graph attributes:

  • Structure: id, parent_id, generation, split_depth, inter_node_id
  • Growth: u, repeat_index, age, internode_length, width
  • Globals: root_distance, height, random, pure_random
  • Effectors: gravity_direction, phototropism_direction, balance_direction

You may also create custom attributes for mapping/gating:

f@wind_influence;   // Mapable attribute
i@kill;             // Marks tip for pruning
v@bend_dir;         // Used by downstream spiral logic

Metadata can be annotated inline:

f@bend;   // @bend: tip="Bend strength" icon="BUTTONS_gamma"

Workflow

  1. Insert a Wrangle after Grow or in a recipe.
  2. Write VEX that emits attributes (don’t inject raw geometry).
  3. Optionally register new attributes in Graph Attributes.
  4. Pass the graph downstream into Simulate.
  5. Use Mapping/Effectors to consume attributes you authored.

How-tos

Density-based pruning

// Kill internodes if too crowded
int near[] = nearpoints(1, @P, 0.2, 5);
if (len(near) > 1) {
    i@kill = 1;
}

Volume-guided growth

// Sample density field from Input 2
float d = volumesample(2, "density", @P);
f@bend = fit01(d, 0.0, 1.5);   // drive bend strength

Age-gated branching

// Reduce fork probability until age >= 3
if (@age < 3) f@fork_probability = 0.0;

See also

  • Wrangle Core — bare-bones node, no mapping integration
  • Grow — standard procedural step
  • Mapping — connect attributes to ramps and functions
  • Effectors — use environment-driven inputs
  • Simulate — evaluates the graph