Collision
particle node
Sets attributes on and/or groups particles when they collide with geometry.
See also: Limit, Soft Limit
This operator performs collision detection between the particles and a referenced SOP’s geometry.
-
Use the Collision Group parameter (on the Behavior tab) to create a group containing the particles that collide. Subsequent nodes in the chain can then act on this group using their Source Group parameters.
-
This operator can add/set attributes and local variables describing the collision to the particles. You can then use these attributes in expressions controlling the particles.
Use the parameters on the Attributes tab to add attributes that store information about the particle’s last collision. With the exception of the
distanceattribute, these attributes are not set unless a collision occurs.
This operator modifies the following attributes: accel, dist, hitCd, hitN, hitid, hitpos, hitposuv, hittime, hituv, numhit.
The particle state can later be queried using some of the following local variables: $DEAD, $SLIDING, $STOPPED, $STUCK.
Using Collision
-
Select the
particle system you want to be affected. -
Click the
Collision tool on the Drive Particles tab. -
Select the object you want the particles to affect and press Enter to confirm your selection.
Choose how the particles will react in the Behavior drop-down menu on the operation controls toolbar or in the parameter editor.
If particles are not bouncing (they are passing straight through the surface you want to collide with), trying increasing the Collision tolerance (on the Collision tab), for example to 0.01.
Attribute and local names
Attribute and local variable names associated with each parameter.
| Parameter | Attribute | Local Variable |
|---|---|---|
| Add Num Hit Attr | numhit | $NUMHIT |
| Add Hit ID Attr | hitid | $HITID |
| Add Hit Time Attr | hittime | $HITTIME |
| Add Hit Pos Attr | hitpos | $HTX $HTY $HTZ |
| Add Hit Pos UV Attr | hitposuv | $HU $HV |
| Add Hit Normal Attr | hitN | $HNX $HNY $HNZ |
| Add Hit Diffuse Color | hitCd | $HCR $HCG $HCB |
| Add Hit Texture UV | hituv | $HMAPU $HMAPV $HMAPW |
| Add Distance Attr | dist | $DIST |
Parameters
|
Activation |
Turns this node on and off. The operator is only active if this value is greater than 0. This is useful to control the effect of this node with an expression. |
|
Source Group |
Only affect a group of points (created with, for example, a Group POP or Collision POP) out of all the points in the input. |
Collision
|
Geometry Source |
Specifies the SOP to use.
|
||||||||||
|
SOP |
Path to the SOP (when Geometry source is set to Use Parameter Values). |
||||||||||
|
Ignore Transform Object |
Particles normally use the object space of the SOP being cooked. Turn this parameter on to not transform into the space of the cooking SOP. |
||||||||||
|
Hint |
Gives the operator a hint about whether the target geometry is moving. This lets the operator choose more effective algorithms for detecting collisions.
|
||||||||||
|
Collision Tolerance |
Distance from geometry at which particle is considered to have collided. |
Behavior
|
Behavior |
Controls how the motion of particles is affected by the collision.
|
||||||||||||
|
Collision Event |
Generate this event when any point collides with the target geometry. |
||||||||||||
|
Collision Group |
The name of a group that will be created to contain the particles that collided. Subsequent operators can use this group to select the particles to affect. |
||||||||||||
|
Preserve Group |
If the group named in the Collision group parameter exists, add the collision particles to the group instead of replacing its contents. |
||||||||||||
|
Use as Hit ID |
Controls what Houdini sets as the “hit ID” (the identity of the geometry the particle collided with). This lets you distinguish a particle that collided in this POP later.
|
||||||||||||
|
Hit Index |
Number to set in the “hit ID” of collision particles. This lets you distinguish different types of collisions. |
||||||||||||
|
Oversampling |
Available when Hint (on the Collision tab) is Translating Geometry. Oversamples the motion of the geometry for more accurate collisions. |
||||||||||||
|
Bounce Accuracy |
Available when Behavior is Bounce on collision. The maximum number of inter-frame bounces a particle will perform. |
||||||||||||
|
Gain Tangent |
Energy loss tangent to collision. |
||||||||||||
|
Gain Normal |
Energy loss normal to collision. |
||||||||||||
|
Final Behavior |
You can optionally choose a different behavior to use when a particle’s impulse falls below a minimum. For example, if you want particles to stop instead of traveling imperceptibly slowly, set Final behavior to Stop and Minimum impulse to a low number. |
||||||||||||
|
Minimum impulse |
Available when Final behavior is not Bounce on collision. The impulse value below which a particle will switch to using Final behavior parameter. |
Constraints
|
Enforce Orientation |
Ensures that the normal component of a bounce on successive collisions is consistent with the first bounce in that frame, when multiple collisions occur within a frame. Suppose you have set the normal gain on a bounce to be small. This means the particle will tend to bounce parallel to the surface, not away from the surface. Once the particle is traveling parallel to the surface, Houdini could detect another collision, perform a bounce, but because the particle was traveling slightly away from the surface, the particle ends up passing through the geometry when it reflects. To prevent this, the Enforce Orientation setting records the orientation of the initial bounce with respect to the normal of the surface, and does not apply the normal gain to any bounces with the “wrong” orientation. You would very rarely turn this off. Some conceivable reasons, however, are:
|
|
Add Hit Test Attribute |
Uses an attribute to ensure orientation consistency across all frames. The same problem that makes enforcing the orientation within a single frame desirable exists across multiple frames. A legal bounce could occur one frame, and then three frames later the only bounce could be an “illegal” bounce. To detect this, Houdini must keep track of the relative orientation from the first bounce in the earlier frame for each particle. |
|
Hit Test Attribute |
The name of the attribute to use to enforce orientation across frames. This attribute should be unique for each Collision POP in the particle simulation which needs to use one, hence the strange default name. Any automatic method of naming this attribute might fail if you have an initial state of a particle system from a different particle network. |
|
Do Normal Step Correction |
It is possible for bouncing particles to leak through the collision geometry. This option adds a corrective step in the collision algorithm which attempts to use the normal of the previous collision to detect and correct leaks. Turn this on when particles are leaking through the collision geometry with a velocity mostly normal to the surface. Normal Step Distance and Back Step Distance are the maximum distances to use when performing the respective corrective steps. A back step allows the detection of leaks even when the particle velocity is mostly parallel to the collision geometry. Increasing the distances will generally tend to reduce the number of leaking particles. There are trade-offs, though: larger distances can cause more stuttering when the corrective step passes through some curvature of the surface. |
|
Prev Normal Attribute |
The name of the attribute to use to store the normal from the previous collision for the normal step correction. This should be unique for each Collision operator in the simulation. This is similar to the Hit Test Attribute parameter. |
|
Normal Step Distance |
The maximum distance to use when attempting the normal step correction. |
|
Back Step Distance |
The normal step correction can fail, particularly if the particle has leaked through a sharp corner in polygonal geometry. In that case, it is still possible to detect and correct the leak, but by having the particle step backwards. This parameter is the maximum distance to use when attempting the back step correction. This correction is done only if the user has specified a hit test attribute and a non-zero back step distance. This correction does not generally work well on surfaces with smooth curvature and can result in particles moving backwards as they bounce. |
Attributes
This tab contains checkboxes for the different attributes you can have set on particles when they collide with the target geometry.
|
Add Num Hit Attribute |
Number of times collided ($NUMHIT). |
|
Add Hit ID Attribute |
Hit ID ($HITID). |
|
Add Hit Time Attribute |
Time of collision ($HITTIME). |
|
Add Hit Position Attribute |
Position in space where collision occurred ($HT{XYZ}). |
|
Add Hit Position UV Attribute |
Parametric position on surface where collision occurred ($H{UV}). |
|
Add Hit Normal Attribute |
Normal where collision occurred ($HN{XYZ}). |
|
Add Hit Diffuse Color Attribute |
Diffuse color at collision ($HC{RGB}). |
|
Add Hit Texture UV Attribute |
Texture uv at collision ($HMAP{UVW}). |
|
Add Distance Attribute |
Distance from current position to collision ($DISTANCE). |
Local variables
Standard POP local variables
|
AGE |
The seconds a particle in the template has been alive. |
|
AX AY AZ |
Acceleration of the particle. |
|
BBX BBY BBZ |
The point’s relative position in the bounding box. |
|
DEAD |
Point is dead. |
|
ITER |
Processing iteration number. |
|
JUSTHIT |
A collision for this particle was detected (for example, by the Collision POP) during the processing of this timestep (that is, this iteration of the particle simulation). This variable is cleared at the beginning of each timestep. Note that the collision POP actually detects any collisions which would have occurred the during the previous frame. |
|
LIFE |
Percent of total life used (from 0 to 1). |
|
LIFESPAN |
Expected lifetime of particle. |
|
MAPU MAPV MAPW |
Point or vertex texture coordinates. |
|
NPT |
Total number of points. |
|
NGRP |
Total number of points in source group. |
|
NX NY NZ |
Normal vector. |
|
PT |
The point number of the currently processed point. The |
|
RESTX RESTY RESTZ |
The rest position. |
|
SLIDING |
The sliding state of the particle. |
|
SPRINGK |
Elasticity of a point. |
|
STOPPED |
Point is stopped. |
|
STUCK |
1 if particle is stuck to a collision object. |
|
TENSION |
Spring tension. |
|
TIMEINC |
Time increment. |
|
TX TY TZ |
Point position. |
|
U V |
Surface UV values. |
|
VX VY VZ |
Velocity direction. |
|
WEIGHT |
Point spline weight. |
Added by Collision POP/Limit POP
|
DIST |
Distance from particle to last collision. |
|
HCR HCG HCB |
Diffuse color at the collision point on the surface the particle collided with. |
|
HITID |
ID for last collision. You can control how this attribute is set in the Collision or Limit POP to help distinguish types of collisions. |
|
HITTIME |
The time at which the last collision occurred. |
|
HMAPU HMAPV |
The texture map UV coordinates for the surface location where the last collision occurred. |
|
HNX HNY HNZ |
The normal at the surface location where the last collision occurred. |
|
HTX HTY HTZ |
World space position of the last collision. |
|
HU HV |
The UV coordinates for the surface location where the last collision occurred. |
|
NUMHIT |
Number of times the particle has collided. |
Added by Color POP
|
CA |
Point or vertex alpha value. |
|
CR CG CB |
Diffuse point or vertex color. |
Added by Property POP
|
ATTRACT |
Attractor point. |
|
CHARGE |
Charge of the particle. |
|
CLING |
Point is clinging to geometry. |
|
DRAG |
Point drag. |
|
FOLLOW |
Leader to follow. |
|
MASS |
Point mass. |
|
PSCALE |
Particle Scale. |
|
SCALEX SCALEY SCALEZ |
Non-uniform scale. |
Added by Proximity POP
|
NEAREST |
Either the point number or id of the particle nearest to this one. |
|
NEARESTDIST |
The distance to the nearest particle. |
|
NUMPROXIMITY |
The number of particles within a specified proximity to this particle. |
Added by Rotation POP
|
ROTA |
Rotation angle. |
|
ROTX ROTY ROTZ |
Rotation axis. |
Added by Source POP
|
GEN |
Generation. |
|
ID |
ID number, which always remains constant. |
|
ORIGIN |
Original Source point was birthed from. |
|
PARENT |
Parent’s ID Number. |
Added by Speed Limit POP
|
SPEEDMAX |
Maximum speed. |
|
SPEEDMIN |
Minimum speed. |
Added by Sprite POP
|
SROT |
Sprite rotation around view axis (in degrees). |
|
STEXU STEXV |
Texture coordinate of sprite’s lower-left corner. |
|
STEXW STEXH |
Size of sprite in texture space. |
|
SX SY |
Sprite scale. |
Controlled by Suppress Rule POP
|
SUPPPOS |
Suppress default position rule. |
|
SUPPVEL |
Suppress default velocity rule. |
|
SUPPUP |
Suppress default up-vector rule. |
|
SUPPAGE |
Suppress default aging rule. |
|
SUPPROT |
1 if particle is suppressing its default rotation rule. |
|
SUPPANGVEL |
1 if particle is suppressing its default angular velocity rule. |
Added by Up Vector POP
|
PVX PVY PVZ |
Previous velocity. |
|
UPX UPY UPZ |
Up vector. |
Added by Location, Source, Softbody, Split POPs
|
SPEED |
Absolute speed of particle. |
Example files
BirthRing
$HFS/houdini/help/examples/nodes/pop/collision/BirthRing.cmd
Every time a particle collides with a surface, an Event POP is used to create an event called 'birth'.
This event activates the Source POP that follows, in order to birth more particles. Events can happen on single frames only, and are not 'continuous' occurrances.
BounceSplit
$HFS/houdini/help/examples/nodes/pop/collision/BounceSplit.cmd
This files takes the idea from the Birthring example and expands upon it with the use of Split POPs.
When the bouncing particle collides with the surface, a Split POP is used to create more particles on collision.
A Velocity POP gives applies velocity to those particles birthed from the Split POP and a Speedlimit POP constrains that velocity to be circular.
Capture
$HFS/houdini/help/examples/nodes/pop/collision/Capture.cmd
This example shows how you can use groups to selectively apply different behaviors to particles. The particles first fall through the collision sphere. Only after passing through the sphere do they exhibit a different collision behavior and bounce on contact.
If the particle has collided, we want the particles to bounce. If they haven’t collided yet, we want them to fall through.
To do this, create a group of all points that have collided. The same Group POP can be used to create the complementary group of points that have not collided. Note that the Collision POP creates the “numhit” attribute so when it is accessed by the Group POP on frame 1, it hasn’t been created yet. The default value of 0 is used, which is fine since on frame 1, none of the particles have collided.
Then two Collision POPs are used to collide the particles against the sphere. The first collision is applied to the “noncollided” group and those particles are allowed to continue on course. The second collision is applied to the “collided” group and those particles should bounce off the collision object.
Deforming
HitColor
$HFS/houdini/help/examples/nodes/pop/collision/HitColor.cmd
This network demonstrates how the Collision POP can be used to tranfer attributes, color in this case, from the collision geometry to the particles that come in contact with that geometry.
A Color POP is used to actually apply the color, as RGB values, to the collided particles.
Meteor
$HFS/houdini/help/examples/nodes/pop/collision/Meteor.cmd
Particles fall from the sky and collide with a collision object, in this case a simple grid.
These single particles that have collided are placed in a group, and they are told to 'continue on course' so they are not themselves affected by the collision.
A half-sphere geometry is instanced to the particles for the purposes of the Split POP.
The grouped particles are then piped into a Split POP which then births even more particles after the collision, giving the effect of a meteor trail or fireball trail.
The split particles are birthed from the surface of the instanced geometry rather than simply the original particle.
Usages in other examples
| Example name | Example for | |
|---|---|---|
| Avoidance |
Turn particle node |
|
| Color |
Attribute Transfer particle node |
|
| Splatter |
Event particle node |
|
| InstanceBounce |
Instance particle node |
|
| HitId |
Color particle node |
|
| SoftBodySheet |
Soft Body particle node |