Prune

Removes branches or internodes when conditions are met. Prune re-evaluates conditions across a test lifetime, optionally with a delay, making it useful for density control, age-based cleanup, or time-varying growth logic.

Prune

Prune removes existing branches when certain conditions are met.
It evaluates attributes on internodes and marks them for removal when thresholds or rules are satisfied.

Unlike one-shot conditions, Prune can re-evaluate over time, which makes it effective when attribute values change after creation — for example, branches that should only die once they reach a certain height or age.


Concept

  • Conditional removal — check an attribute against a constant, another attribute, or a mapping.
  • Cycles — each internode is tested repeatedly during its lifetime, so pruning is not limited to a single chance.
  • Delay — growth can proceed for some time before pruning begins, allowing controlled staging.
  • Iterative feedback — combines well with Wrangles or Mappings that update attributes across iterations.

⚠️ Note: Natsura currently has limited support for attributes that evolve over time on already-created geometry, except when using Wrangle. Wrangles can inject dynamic logic that makes Prune more powerful.


Inputs

Input 0 — Graph
The incoming Apex graph.

Output — Graph
The same graph with pruned internodes removed, ready for downstream evaluation or Simulate.


Parameters

  • Compare Attribute (graph_attribute_a)
    Attribute to test (e.g. height, age, width).
  • Condition (graph_threshold_operation)
    Operator (>=, <=, ==, etc.).
  • Test Value (gate_value_b)
    Constant value to compare against.
  • Attribute / Map Mode (graph_type_b)
    Instead of a constant, you can compare against another attribute or a mapping chain.
  • Snippet Condition (graph_snippet_condition)
    Optional VEX snippet for custom gating logic.
  • Test Lifetime (cycles)
    Number of times the prune condition is re-evaluated.
  • Start Delay (delay)
    Frames/steps to wait before pruning begins.

Attributes

Prune typically uses attributes already present in the graph, such as:

  • height, age, generation
  • u, repeat_index
  • Any custom attributes created by Wrangle or Mapping chains

Workflow

  1. Insert a Prune node after growth logic (e.g. after Grow or inside a Repeat).
  2. Choose an attribute and condition.
  3. Set Test Lifetime to give branches multiple evaluation chances.
  4. Use Start Delay to allow some growth before pruning begins.

How-tos

Kill tall branches

/// Remove when taller than 5 units
Compare Attribute: height
Condition: >=
Test Value: 5

Density-based cleanup with Wrangle

// In Wrangle: add a density score
f@local_density = nearpoints(0, @P, 0.5);

Then in Prune, set:

  • Compare Attribute: local_density
  • Condition: >
  • Test Value: 4

Branches in overcrowded areas are removed over time.


See also

  • Grow – generates internodes to be pruned
  • Repeat – time-based iteration, useful before pruning
  • Wrangle – inject custom attributes for pruning
  • Switch – alternative gating based on conditions