Collision Geometry for Rigid Body Particles and Obstacles

 
 
 

The Simulate Rigid Bodies and Simulate Bullet Rigid Bodies nodes calculate the rigid body collisions according to the size and shape of the collision geometries, which are not necessarily the same as the particle or obstacle's actual geometric shape. The collision geometry used is different for the particles and the obstacles:

Collision Geometry for Rigid Body Particles

Different types of shapes are used for the rigid body particle's collision geometry depending on the particle's shape type: bounding shapes for the basic particles shapes or convex hull approximations for instanced shapes.

Collision Geometry for Basic Particle Shapes

A bounding shape is automatically assigned to the particle when it becomes a rigid body, using whatever bounding shape is closest to the current particle Shape attribute that is set for it (such as in the Emit compound): bounding sphere, box, capsule, or cone. Bounding shapes provide a quick solution for calculating particle collisions because they don't have to calculate detailed geometry.

   

Bounding boxes are used for the Box, Disc, and Rectangle shapes.

Bounding spheres are used for the Sphere and Blob shapes. Points are approximated by very small spheres.

   

Bounding capsules are used for the Capsule, Cylinder, and Segment shapes. They are also used for the Cone shape by the Simulate Rigid Bodies node.

Bounding cones are used for the Cone shape by the Simulate Bullet Rigid Bodies node. The bounding cone's center of mass is set close to its bottom (as opposed to the middle of the bounding shape for capsules) so that a rotation that is more indicative of a cone results during collision.

Collision Geometry for Instanced Shapes

If you're using instanced shapes on the rigid body particles (see ICE Particle Instances), what is available for the particle's collision geometry depends on which Simulate node you're using:

Convex Hulls

Convex hulls for instanced shapes for particles work in the same way as convex hulls for obstacles (see below). Convex hull calculations take a bit longer than bounding boxes, especially when you have many particles, but they give a more accurate representation of the instanced geometry.

If you're using the Simulate Bullet Rigid Bodies node, select Convex Hull (Bullet RBDs Only) as the RBD Type in the Instance Shape or Set Instance Geometry node to use convex hulls.

Convex hulls are not supported by the Simulate Rigid Bodies node.

In this image, the cereal pieces are using convex hull approximations. Their holes are not considered for the collision geometry, but their outer contours are. This allows them to pile up with a fair amount of accuracy.

Bounding Boxes

Bounding boxes create a box shape around the instanced geometry, not considering their contours or any concavities. This lets you create faster, but less accurate, rigid body simulations.

However, you can set the CollisionShape attribute (in a Set Data node) to change the shape of the collision geometry for particles to Box or Sphere. For example, you may want to use a bounding sphere if it better reflects the shape of the instanced geometry you're using. If you do this, you will probably also need to set the CollisionSize attribute to better reflect the size of the particle geometry (see below).

  • If you're using the Simulate Bullet Rigid Bodies node, select BBox as the RBD Type in the Instance Shape or Set Instance Geometry node to use a bounding box for the instanced geometry.

  • If you're using the Simulate Rigid Bodies node, only bounding boxes are supported for the instanced geometry shape.

In this image, the cereal pieces are using bounding boxes, which doesn't let them pile up with the same accuracy as convex hulls; however, the simulation is faster.

NoteIf you really need the colliding particles to be the actual shape of the instanced geometry, especially for any "hero" pieces that get close to the camera, you may want to use the non-ICE rigid body system (see Rigid Bodies).

Setting Offsets for the Particle Collision Size and Scale

Rigid body particles have a thin skin surrounding them. This usually helps to prevent objects from going through one another without colliding, or helps prevent problems when using grids and flat objects as obstacles. However, the skin is also why you may notice small interpenetrations with the rigid bodies.

To solve this problem, there are two particle attributes that you can set to determine the particle's collision geometry size: CollisionSize and CollisionScale.

The particle's Size attribute is used for collisions unless the CollisionSize attribute is defined; likewise for the particle's Scale and CollisionScale attributes.

  • CollisionSize is the size of the particle's collision geometry.

    You can set a particle's collision geometry size to be bigger than the particle size and counter the interpenetration caused by the skin. Making the CollisionSize value larger increases the chance of collisions while keeping the actual particle size small.

  • CollisionScale is the size of the particle collision geometry on each of its XYZ axes.

    This attribute is useful for creating oblong shapes that cannot be defined by Size or CollisionSize alone.

To set these attributes, create a Set Data node and expose each attribute in it — see Getting and Setting ICE Particle Attributes for more information on how to do this.

Plug the Set Data node's Execute output into the Execute on Emit port of an Emit compound to set this value once. Or plug it into an Execute port in the Simulation Root node (above the Simulate Bullet Rigid Bodies or Simulate Rigid Bodies node) to update the data at every frame.

Collision Geometry for Rigid Body Obstacles

You can use either the actual shape or a convex hull of the obstacle's geometry depending on which Simulate node you're using to simulate the rigid bodies.

Actual Shape

Actual shape is just that: the actual shape of the obstacle's geometry is used as the collision geometry. This allows you to use obstacles that are concave (such as bowls or boxes). For best results, the obstacle should be volumetric: this is because the Bullet physics engine decomposes the object into multiple convex hulls based on volume in order to calculate the object's actual shape.

The obstacle's geometry can also deform over time (such as being shape-animated) and the collisions will remain accurate; however this may increase the simulation time because the shape is recalculated at every frame.

If you're using the Simulate Bullet Rigid Bodies node, select the Exact Shape option (per obstacle) in the Simulate Bullet Rigid Bodies node to use that obstacle's actual shape.

Actual shape is not supported by the Simulate Rigid Bodies node.

In this image, the actual shape of both the cereal box and bowl are used. The particles are emitted from a volume shape that is inside the box.

Convex Hulls

Convex hulls give a quick approximation of an object's actual shape to be used for the collision geometry, with the results similar to an object being shrinkwrapped with plastic. Convex hulls don't calculate any dips or holes in the rigid body geometry, but are otherwise the same as the rigid body's original shape (the basic outer contours are respected).

  • If you're using the Simulate Bullet Rigid Bodies node, deselect the Exact Shape option (per obstacle) in the Simulate Bullet Rigid Bodies node to use convex hulls.

  • If you're using the Simulate Rigid Bodies node, you can use only the convex hull approximation of the obstacle's shape. However, you can "create" your own non-convex obstacle by decomposing the obstacle object into separate proxy geometries, grouping them, and then using the group as the obstacle.

In this image, the bowl's interior is "cut off" from being part of the collision, so the cereal pieces simply bounce off its top as if it was shrinkwrapped. However, the cereal pieces collide correctly with the outside of the bowl.

Tips for Better Collisions

  • Collisions don't work well with very thin objects, so grids are generally not a good idea to use as obstacles. It's better to use a flattened cube that has some thickness, such as for creating a ground plane or table. You can use the Apply Thickness tool to quickly make a 2D polygon mesh object have volume! The thickness that you need depends on the particles' size and speed, as well as the simulation precision.

  • Small particles (especially sphere-shaped ones) with a high velocity can sometimes go through collision objects. To remedy this, you can set the Precision parameter in the Simulate Rigid Bodies or Simulate Bullet Rigid Bodies property editor. It allows you to set the number of substep iterations that should be made when detecting collisions and resolving motion. By default, the precision is 60 (a substep iteration cannot be longer than 1/60 seconds).

  • You can also increase the particle's Subframe Sample value for more accurate collisions - see ICE Simulation Subframe Sampling.

  • To prevent rigid body particles from poking through collision objects as they are born, make sure that the emitter object is at least half of the maximum particle radius away from the collision objects.

  • When rigid body particles are born, their collision geometry can overlap, which causes them to repel each other with increased velocity on the first frame of the simulation. To help reduce this problem, you can decrease the size of the collision geometry (set the CollisionSize attribute lower than the particle Size - see above). Make sure that the size isn't so low that the rigid body particles noticeably penetrate each other.

    You can also selectively mute collisions per particle based on time or on overlapping collision geometry. Simply muting the collisions when a particle is very young can give it enough time to move away from its neighbors and avoid "blasting apart" when it's born.

  • If the particles are bouncing around too much when they collide, set their Elasticity attribute with a low value and/or lower the collision object's Elasticity value — see Setting the Elasticity and Friction. You can also reduce the particle speed (see ICE Particle Speed), which also has an effect on how rambunctious they are when colliding with each other.

Creative Commons License Except where otherwise noted, this work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License