Prune

Removes branches or internodes when conditions are met. Re-evaluates conditions over time, useful for density control and age-based cleanup.

The Prune node removes existing branches when certain conditions are met.

  • Conditional Removal: Evaluates attributes on internodes and marks them for deletion.
  • Time-Varying: Can re-evaluate conditions over multiple cycles, allowing branches to be pruned later in their life (e.g., when they get too old or crowded).
  • Delayed: Supports a start delay to allow initial growth before pruning begins.

Concept

Iterative Evaluation Unlike a one-shot filter, Prune is designed to work within the iterative growth loop. It checks every internode against its rules multiple times (Test Lifetime), allowing for dynamic behaviors like "survival of the fittest" where branches compete for space over time.

Conditions Pruning logic can be simple (Thresholds) or complex (Mappings/Wrangles).

  • Threshold: Height > 10
  • Attribute: Width < Length
  • Mapping: Density > Map(u)

Inputs

  • Input 0 — Graph The incoming Apex graph.
  • Output — Graph The graph with pruned internodes removed.

Parameters

Condition

  • Compare Attribute: The attribute to test (e.g., height, age).
  • Operator: The comparison type (>, <, ==).
  • Test Value: The value to compare against. Can be a Float, another Attribute, or a Mapping.

Timing

  • Test Lifetime: How many times to re-evaluate the condition for each internode.
  • Start Delay: How many steps/iterations to wait before starting the checks.

Advanced

  • Snippet Condition: Inline VEX for custom logic.

Attributes

Prune consumes attributes but does not typically emit new ones.

  • Common Inputs: height, age, u, generation, density (custom).

Workflow

  1. Place a Prune node after your growth logic (e.g., inside a Repeat block).
  2. Select an attribute to test (e.g., height).
  3. Set the condition (e.g., > 5.0).
  4. (Optional) Use a Wrangle before the Prune node to calculate complex metrics like "local density" and store them in an attribute for Prune to check.

NodeRelationship
GrowGenerates the geometry to be pruned
WrangleCalculates custom attributes for pruning logic
SwitchAlternative gating (stops growth instead of removing it)