Natsura Switch
The Switch node gates growth flow, acting like an if/else statement for your graph.
- Conditional Routing: Chooses between multiple input graphs based on conditions evaluated per internode.
- State-Driven: Enables logic like "if age > 5, switch to flowering logic".
- Adaptive: Allows recipes to react to their own attributes or environment.
== Concept ==
=== Gating Logic ===
Switch evaluates a list of conditions in order. The first condition that evaluates to true determines which input graph is executed for that specific internode. If no conditions match, the default path is taken.
=== Use Cases ===
- Transitions: Bud to Shoot to Flower.
- Environment: Grow tall in sun, grow wide in shade.
- Variation: Randomly choose between different branch structures.
- Lifecycle Modeling: Manage discrete stages such as vegetative growth, flowering, and senescence.
- Environmental Adaptation: Switch behaviors based on light exposure, proximity, or other signals.
Inputs
== Inputs ==
Input 0 (Graph A): Executed if the switch evaluates to False (or matches Condition 0).
Input 1 (Graph B): Executed if the switch evaluates to True (or matches Condition 1).
Output (Graph): The merged graph.
Parameters
Overview
Concept
Gating Logic
Use Cases
Parameters
Condition
Graph Operation : Integer-based mode selector that toggles between "Threshold" and "Snippet" operations.
Graph Threshold (A) : The mode of input comparison for threshold conditions. Includes both attribute-based and scalar values.
Value (A) : Specifies a scalar threshold for decision-making.
Attribute (A)
: The attribute to read (e.g., age). Uses geometry attributes for evaluation in threshold operations.
Threshold Operation : The operator for comparison. Specifies logical operations such as equals (==), greater than (>), or less than (<).
Graph Threshold (B) : Similar to Graph A, used in conjunction with secondary input conditions.
Value (B) : The value to compare against. Secondary scalar for decision-making.
Snippet Condition
: Inline VEX for complex logic (e.g., (@age > 5) && (@height < 2)). A scriptable input field for more advanced user logic.
Related
- Grow Node — Creates the internodes that Switch routes. Incrementally creates plant structures by defining the size, shape, and direction of individual branches.
- Split Node — Unconditional parallel branching. Enables axillary branching by splitting growth into separate paths.
- Wrangle Node — Creates attributes for Switch conditions. Allows users to write custom VEX code for advanced procedural control.
- Repeat Node — Reevaluates Grow over multiple iterations to generate branching hierarchies.
- Signal Node — Guides plant growth using external data such as vector fields or collision geometry.
- Simulate Node — Processes the procedural graph and environmental inputs to generate complete plant structures.
- Prune Node — Removes components of the plant structure to simulate natural shedding or manual trimming.
- Map Node — Maps attributes to parameters for dynamic control.
@intro
Getting Started
If you're new to the Natsura toolkit, begin by visiting the Overview|../../natsura/index. The index provides a comprehensive overview of the system, including descriptions of all nodes and how they work together to create procedural plant models. It's the ideal starting point for understanding core concepts and deciding which nodes to explore first.
@attributes
== Attributes ==
Switch consumes attributes for gating.
Common inputs: age, u, generation, height, random.
@workflow
== Workflow ==
- Create two different growth subgraphs (e.g., "Leafy Branch" and "Bare Branch").
- Connect them to a Switch node.
- Set a condition (e.g.,
height > 10). - Internodes below height 10 will use the first graph; those above will use the second.
- Set Graph Operation: Choose between "Threshold" and "Snippet" modes based on the complexity of the logic required.
- Preview and Iterate: Dynamically observe and refine path switching based on simulation outcomes.
@applications
== Applications ==
- Lifecycle Modeling: Manage discrete stages such as vegetative growth, flowering, and senescence.
- Environmental Adaptation: Switch behaviors based on light exposure, proximity, or other signals.
- Complex Simulations: Integrate multiple growth types within a single graph.
- Transitions: Bud to Shoot to Flower stage changes.
@notes
- Threshold Mode: Ideal for discrete, attribute-driven decisions.
- Snippet Mode: Offers advanced customization through scripting, suitable for nuanced behaviors.
- Gating Logic: The first condition that evaluates to true determines which path is taken for each internode.