Occasionally you may be working with animated collision geometry that intersects with itself. This can result in errors for the cloth solver, because the cloth geometry will have no where to go.
In this example, the upper arm intersects with the chest. One way to rectify this issue is by turning the entire collision geometry into a Vellum Cloth object and using soft and hard pin constraints. You can also use a Peak SOP to slightly increase the thickness of the collision geometry. This is a precautionary measure to create more space for the cloth, which will hopefully avoid any post-sim intersecting problem areas.
-
Create an attribute called
pin
using the Attribute Create SOP. -
Add a Paint SOP with an override for the newly created pin attribute. Red areas have a value of 1 and will retain its original shape, while blue areas have a value of 0 and will become soft and malleable.
-
Add a Vellum Configure Cloth node to give the entire collision geometry Vellum cloth constraints.
-
Add a Vellum Constraints SOP and set the Constraint Type to Pin to Target, Pin Type to Soft, and turn on the Match Animation checkbox. Also set the Geometry Group to
@pin<1
, which will ignore all red areas that have a value of 1. This will now act as the soft constraints for the parts of the collision mesh you want to deform. -
Set the Stretch Stiffness to a lower value to allow some varying stiffness over these points.
-
Add another Vellum Constraints SOP and set the Constraint Type to Pin to Target, Pin Type to Permanent, and turn on the Match Animation checkbox. Also set the Geometry Group to
@pin == 1
, which will ignore all the non-red areas that have a value less than 1. This will now act as the hard constraints for the areas of the collision mesh you don’t want to deform. -
Set the Stretch Stiffness to
1e+10
for an infinitely stiff strength. -
On the Vellum Sovler, set the Substeps value to 5 for more accurate collision results.
Once solved, the animation is unchanged in areas on the collision geometry with a red painted value of 1, and all non-red painted areas with values less than 1 are soft, allowing intersecting collision areas to be deformed and resolved. This creates a gap between intersecting collision geometry, allowing both sets of constraints to be satisfied as the cloth will have space to move.