Collisions

Collisions with a Polygonal Mesh
Get/Set Cloth Vertices
Get/Set Collider Faces
Paint envelope
Tips
Collisions with a Polygonal Mesh

The animation of a cloth is in most of the cases driven by its collisions with the body of the character. Computing these collisions can be extremely time consuming. The solution chose in Syflex uses envelopes:

There is an external envelope outside of the object, and an internal envelope inside. Whenever a vertex of the cloth enters the volume defined by these two envelopes, the vertex is repelled outside of the volume.
The external envelope should be big enough to avoid penetration problems due to the fact that collisions are computed between vertices of the cloth and faces of the collider, as illustrated on this figure:

When a point of the cloth enters in contact with the collider, it progressively slows down (damp coefficient), and then stops. A force big enough must be applied on the point to move it again (friction coefficient).
To setup collision detection between a cloth and an object, select both of them and chose in the Syflex menu:
Syflex > Collisions > Collide Mesh
Collision are controlled by the following attributes:
  • Active
    The collision is computed only when this attribute is set to 'on'.
  • Friction
    Defines the roughness of the contact between the two materials.
    Range: from 0 (no friction) to 1 (maximum friction). In general around 0.2
  • Damp
    Points of the cloth in contact with the collider are slowed down according to this attribute.
    Range: between 0 and 1. In general around 0.0001 or 0.001
  • Bouncing
    Bouncing coefficient.
    Range: from 0 (no bouncing) to 1 (maximum bouncing).
  • External envelope
    Distance between the collider face and the external envelope. Choose a value as small as possible to increase the computation speed.
  • Internal envelope
    Distance between the collider face and the internal envelope. This value must be negative.
  • Display envelope
    Display the external envelope.
  • Changing
    Set this flag to 'on' if the topology of the collider changes at each frame. This slows down the simulation, and results in a lower quality. Use it only if the number of faces (or vertices) changes, or if their order changes. For instance, if the collider is at each frame converted from a nurbs to a polygonal mesh, the vertex ordering might not be the same.
  • Smooth Anim
    (replaces "Animated" in previous versions).
    When set to a non-null value, the motion of the colliding object is interpolated during the simulation, increasing the quality. This is important when the object is animated or deformed.
    Range: between 0 and 1.
    The smaller the value, the fastest the simulation, but the lower the quality.
    If the object is not animated, set this parameter to 0 to optimize the simulation speed.
  • Env World
    Envelopes are defined in world coordinates when this attribute is set to on. Else the envelopes are in object space, and they are transformed (and scaled) by the transformation of the collider.
Get/Set Cloth Vertices

By default, collisions are computed for all vertices of the cloth. It's sometimes useful to compute collisions only on specified vertices of the cloth. This may also speed up collision computations if you know which vertices never collide.
To specify these vertices:
- select the collider node (in the outliner or the hypergraph for instance)
- select the vertices from the cloth
- call in the menu: Syflex > Collisions > Set Cloth Vertices
The order of selection is not important but both the vertices and one collider must be selected.
Each collider node keeps its own list of colliding vertices.
To retrieve the list of colliding vertices, select a collider node, and call in the menu:
Syflex > Collisions > Get Cloth Vertices
This will select the vertices.
To modify the colliding vertices, use Get Cloth vertices, modify the list of vertices, then call Set Cloth Vertices.

Get/Set Collider Faces

By default, collisions are computed for all faces of the collider. It's sometimes useful to compute collisions only on specified faces of the collider. This may also speed up collision computations if you know which faces never collide.
To specify these faces:
- select the collider node (in the outliner or the hypergraph for instance)
- select the faces from the collider
- call in the menu: Syflex > Collisions > Set Collider Faces
The order of selection is not important but both the faces and one collider must be selected.
Each collider node keeps its own list of colliding faces.
To retrieve the list of colliding faces, select a collider node, and call in the menu:
Syflex > Collisions > Get Collider Faces
This will select the faces.
To modify the colliding faces, use Get Collider Faces, modify the list of faces, then call Set Collider Faces.

Paint envelope

The width of the external envelope can be painted using the paint attribute tool (in the Modify menu).
Select syCollide > envMap. The default value in the map is 1.0.
The envelope is the product of the per vertex map value and the global "External envelope" attribute.

Tips

Setting envelopes
Remember that the envelope is a distance. The correct value can be guessed depending on the units used (ie. the scene is defined in meters, centimeters, inches, ...). On a character, first try with an external envelope of 1 centimeter (or half an inch), and an internal envelope of -1 centimeter (or -1/2 inch).

If the collider is in some places visible through the cloth, as in the picture above, increase the external envelope.

If the movement of the cloth (or of the collider) is too fast, collisions might not be detected soon enough. Some vertices of the cloth might penetrate the collision object. In this case the internal envelope must be increased (from -.1 to -.2 for instance).

Speed
The smaller the envelope, the faster the computation.
The inner envelope can be as small as 0. In this case only the outer envelope is used.
Envelopes can also be animated. This must be done smoothly to avoid introducing vibrations.
If you know where the collisions happen, restrict the area where collisions are computed by using :
Set Cloth Vertices
Set Collider Faces

Multiple collisions
The animation of the character is not always perfect. For instance, around the armpits, the arm might penetrate the body (or envelopes from both sides might intersect). This is highly undesirable: the simulator doesn't really know what you want in this case. Depending on the cases, it will use only one collision, or will average both collisions. If this causes problems in the animation, the best solution is, of course, to clean the animation of the character. If this is not feasible, try separating the body in 2 parts (the body and the arm) and compute 2 collisions (overlapping one polygon). You should also increase slightly the internal envelope.
Syflex LLC - www.syflex.biz