Custom Particle Interactions in Blender Geometry Nodes
Building custom particle interactions in Blender Geometry Nodes allows you to create tailored physics systems—such as flocking behaviors, particle collisions, and custom force fields—without relying on the legacy particle system. By leveraging the Simulation Zone alongside vector math, proximity sampling, and field manipulation, you can define frame-by-frame rules that dictate how individual particles react to their environment and to each other.
1. Setting Up the Simulation Zone
The foundation of any custom particle system in Geometry Nodes is the
Simulation Zone (Simulation Input and
Simulation Output).
- Add a Simulation Zone to your node tree.
- Initialize your particles by connecting a mesh or point cloud (e.g.,
from a Distribute Points in Volume or Mesh to
Points node) to the
Simulation Input. - Add custom attributes to the Simulation Zone by clicking the plus
icon on the input node. Define attributes such as
Velocity(Vector) andAge(Float). - Update position inside the zone using a Set
Position node, feeding the updated position as:
New Position = Current Position + (Velocity * Delta Time)
Use the Scene Time node's Delta Time
output to ensure the simulation remains frame-rate independent.
2. Calculating Particle-to-Particle Interactions
To make particles interact with one another (e.g., attraction, repulsion, or flocking behavior), you need to sample neighboring particles within the simulation loop.
Point Proximity and Repulsion
- Use the Sample Nearest node set to Point domain to find the index of the closest neighboring particle.
- Use the Sample Index node to retrieve the position of that neighbor.
- Calculate the direction vector from the neighbor to the current
particle:
Direction = Current Position - Neighbor Position - Calculate the distance using a Vector Math (Distance) node.
- Apply a force based on distance (such as inverse distance for repulsion).
- Add this force to the particle's
Velocityvector.
For multi-particle interactions (such as full N-body simulations), chain multiple Sample Nearest queries using index offsets or use repeat zones to iterate through nearby points.
3. Creating Custom Force Fields
Custom external forces, such as vortices, gravity, or turbulent noise, can be added directly to the velocity vector on each frame.
- Directional Gravity: Use a Vector Math
(Add) node to add a constant downward vector (e.g.,
[0, 0, -9.8] * Delta Time) to the velocity. - Turbulence: Connect a Noise Texture to a Vector Math (Subtract 0.5) node to center the noise, scale it by a force intensity float, and add it to the velocity.
- Attractors/Repellers: Compute the vector between the particle and an empty/object's position using the Object Info node. Normalize the vector, divide it by the distance squared, and add the result to the particle's velocity.
4. Implementing Surface Collisions
To make particles interact with geometry surfaces:
- Bring the collider mesh into the node tree using an Object Info or Collection Info node set to Relative.
- Use a Raycast node inside the Simulation Zone:
- Ray Origin: Current particle position.
- Ray Direction: Normalized particle velocity.
- Ray Length: Velocity magnitude multiplied by
Delta Time(the distance the particle will travel this frame).
- If the Raycast output
Is Hitis true:- Reflect the velocity vector using the formula:
Reflected Velocity = Velocity - 2 * (Velocity ⋅ Hit Normal) * Hit Normal - Multiply the reflected velocity by a friction or restitution factor
(e.g.,
0.8for a dampening bounce). - Set the particle position to the
Hit Positionplus a slight offset along theHit Normalto prevent particles from penetrating the surface.
- Reflect the velocity vector using the formula:
5. Managing Particle Lifetime and Spawning
Dynamic systems require spawning new particles and killing old ones over time:
- Spawning: Use a Join Geometry node inside the Simulation Zone to merge newly generated points (from a dynamic emitter) with the existing simulated points.
- Aging: Add
Delta Timeto theAgeattribute on every frame using a Math (Add) node. - Deletion: Pass the points through a Delete
Geometry node, setting the selection to
Age > Max Lifetime.
6. Improving Simulation Stability
To prevent high-speed particles from passing through colliders or jittering during complex interactions:
- Wrap the internal physics calculations inside a Repeat
Zone within the Simulation Zone to perform sub-stepping (e.g.,
running the calculation 4–8 times per frame with
Delta Time / Substeps). - Use a Vector Math (Clamp) or dynamic drag calculation to enforce terminal velocity and avoid exponential energy buildup.