Conditional Logic¶
Use the Logic effect to test conditions and run actions on particles. Build nested If / Else If / Else branches, combine conditions, run loops, organize items in folders and store custom particle data.
Logic is evaluated for each active particle that reaches the effect. Conditions read the particle state at that point in simulation order; actions write state that later instructions and later effects can use. Place Logic after the effects whose results it must test and before effects that should consume its changes.
Lists workflow¶
- Add Logic after the relevant Emitters and upstream effects.
- Add an If branch and choose its first Condition.
- Add more Conditions beneath the branch and choose And, And Not, Or, or Or Not.
- Add one or more Actions as children of the branch.
- Add Else If and Else siblings when the outcomes must be mutually exclusive.
- Use Indent and Outdent to verify parentage. Visual order alone does not make an item a child.
- Test with one branch before adding loops or nested branches.
Nodes workflow¶
In Nodes, connect conditions and actions to build the Logic program:
- Add a Logic Condition node and configure the property it should test.
- Use Combine Conditions nodes for And or Or. Use the condition's Evaluate: If Not when one input must be negated.
- Chain Logic Action nodes through Previous to define execution order.
- Connect a condition and the True and False action/program chains to Logic If / Else.
- Chain additional branches or actions through Previous.
- Connect the final Program output to the Logic effect's Program input.
The graph does not infer order from node position. Only links define the program. A Nodes Logic effect requires a connected Program and, as a shared simulation effect, should receive the complete stream after Merge.
Logic Tree¶
Iterations: number of times the Logic tree is evaluated for each active particle during the effect pass.Weight: overall influence of the Logic effect.- Tree controls: Move Up, Move Down, Indent, Outdent, and Remove organize the hierarchy.
If: starts a conditional branch.Else If: adds another tested branch after an If/Else If.Else: fallback branch when previous branches did not match.Condition: adds another condition to the current branch.Combinesupports And, And Not, Or, and Or Not.Action: performs a particle operation when the active branch matches.Loop: repeats nested tree items.Typecan beFor IndexorFor Each.Folder: named organizational container for complex trees.
Iterations repeats the completed program for each active particle, up to the UI limit. Repetition is useful when one pass writes state that a later pass should immediately re-evaluate, but it multiplies Logic work and can repeat non-idempotent actions. Weight multiplies the blend factor of blendable Set actions. At zero no actions run; above zero it does not turn discrete actions such as Set Group or Delete into probabilities.
Loop Parameters¶
- For Index:
Start,End, andStep. - For Each:
Target= Particle or Neighbor. Neighbor loops addSearch Radius.
For Index includes both Start and End and uses a positive Step. For Each Particle and For Each Neighbor change the particle read by conditions, but actions still modify the current owner particle. This prevents cross-particle write races and means a neighbor loop is suitable for testing neighbors and accumulating decisions about the current particle, not editing each neighbor directly.
In Nodes, use Add Logic Loop Zone to create the matching Loop Begin and Loop End pair. Connect the body between them and close nested zones from the inside out. Loop zones can nest up to eight levels; For Index is limited to 4096 iterations. Spawn is not supported inside a loop. Break exits the innermost active loop and is invalid outside a loop.
Conditions¶
Every condition has Evaluate = If or If Not. Numeric conditions use comparison modes such as Greater Than, Less Than, Equal To, In Range, Less Than or Equal, Not Equal To, Greater Than or Equal, and Not In Range where applicable.
- Age:
If Age Is,Unit(Normalized / Seconds / Frames), and a Value or Min/Max range. - Life:
If Lifetime Is,Unit(Seconds / Frames), and Value or Min/Max. - Mass, Radius, Speed, Particle Count, Smoke, Temperature, Fuel, Flame, Time, Fluid Density: comparison plus Value or Min/Max.
- Group:
Groupselects a named particle group. - Neighbors:
Search Radius, optionalFilter by Groupwith a named group, and a neighbor-count comparison. - Mask: evaluates a Mask stack against a threshold, allowing spatial/procedural/shared Masks inside Logic conditions.
- On Collision, Is Frozen, On Death, Born This Frame: event/state conditions with no additional numeric parameter.
- Random:
Mode= Static or Animated,Probability, andSeed. - Interval:
Active for,Inactive for, andOffset. - Frame: comparison plus
Frameor Min/Max. - Position / Velocity:
ComponentX/Y/Z plus comparison and value/range. - Rotation: X/Y/Z component plus comparison and Euler value/range.
- Color:
Channel= Red, Green, Blue, Alpha, or Luminance plus comparison and value/range. - Emitter:
Emitterselects the source emitter by name. - Particle ID:
Particle IDmatches a stable particle identifier. - User Float:
Channel= User Float 1 or User Float 2 plus comparison/value. - User Integer: integer comparison/value.
- User Vector:
ComponentX/Y/Z plus comparison/value.
Conditions do not change particle state. A Mask condition compares the combined 0 to 1 mask result with Threshold. Static Random keeps one deterministic result per particle; Animated Random changes deterministically as simulation advances. Fluid Density returns zero for particles without fluid-density data.
Actions¶
- Set Age:
Operation= Set To / Add / Subtract / Multiply,Unit= Normalized / Seconds / Frames,Value, andBlend. - Set Life: Operation, Unit = Seconds / Frames, Value, and Blend.
- Set Mass, Set Radius, Set Speed, Set Smoke, Set Temperature, Set Fuel, Set Flame: Operation, Value, Blend, plus optional
Clamp Resultwith Min/Max. - Set Group:
Set Group Toselects a named particle group. - Set Color: Advanced Color controls plus Blend.
- Set Velocity: Operation,
Velocity, and Blend. - Set Rotation: Operation,
Rotation, and Blend. - Set Rotation Speed: Operation,
Rotation Speed, and Blend. - Spawn:
CountandDistance; Group Mode = Inherit / Set New with named Group; Color Mode = Inherit / Set New with Advanced Color; Rotation Mode = Inherit / Set New with Initial Rotation, Rotation Speed, Random, and Rotation Seed. Spawn Properties can independently Inherit / Set New Lifetime, Mass, Radius, and Velocity. New Lifetime exposes Lifetime (Frames) and Variation; Mass exposes Mass and Random; Radius exposes Radius and Random; Velocity exposes Inherit Factor, Inherit Random, and Add Random Speed.Seedcontrols stable variation. - Delete: removes the matching particle.
- Freeze:
Velocity= Keep or Zero. Keep stores the current linear velocity for release; Zero discards it. Frozen particles stay held with zero visible motion. Unfreeze restores particle integration and, after Keep, the stored velocity. - Break: exits the innermost active Logic loop for that particle. It requires an enclosing loop.
- Set User Float:
Channel(User Float ½), Operation, and Value; the action also participates in the normal blend/clamp action settings. - Set User Integer: Operation and integer Value.
- Set User Vector: Operation, User Vector Value, and Blend.
Persistent User Data¶
Every particle can carry User Float 1, User Float 2, User Integer, and User Vector. Logic can write and test these channels; Data Mapping can read them; Geometry Attributes, Output Cache, and Alembic profiles can preserve them for downstream workflows.
Use these channels for state that has no dedicated particle property. For example, write User Integer when a particle enters a region, test it in a later branch to prevent repeated initialization, and export it for downstream shading or geometry work. Decide which system owns each channel so unrelated Logic effects do not overwrite one another.
Worked example: one-time region change¶
- Add a Box Mask around the trigger region.
- Create an If branch whose first condition is Mask with the required Threshold.
- Add a User Integer condition requiring the value to equal 0.
- Combine the conditions with And.
- Under the matching branch, add the desired action, such as Set Color or Set Group.
- Add Set User Integer and set it to 1 after that action.
- On later evaluations, particles still inside the Box fail the User Integer condition, so the change is not repeated.
- In Nodes, build the same test with Box Mask, two Logic Condition nodes, Combine Conditions, an If / Else node, and an action chain connected to Program.
Troubleshooting¶
- An action never runs: Check hierarchy or graph links, condition units and comparison, effect Mask and Apply to filter, and whether the particle reaches this point in the effect order.
- Else runs unexpectedly: Else belongs to the immediately preceding If or Else If chain at the same hierarchy level.
- An action repeats: Check Logic Iterations and whether its condition remains true on later frames. Store a persistent User value when the action must be one-time.
- A node appears connected but has no execution order: Predicate links only define truth values. Action and branch Program links define execution.
- A loop edits the wrong particle: Loop conditions read the iterated particle or neighbor, but actions intentionally write the owner particle.
- Spawn is rejected: Spawn cannot execute inside Logic loops. Move it outside the loop and store a decision in persistent user data if needed.
- Break is rejected: Place it inside a Loop or Loop Zone. It does not act as a general branch return.
- User data changes elsewhere: Check every Logic effect that writes the same User Float, Integer, or Vector channel and their simulation order.