Cloth in AM ~ Collision Detection

Dec 4, 2003 at 3:02 PM

Let’s see how collision detection works before we get too much further. Back in your modeling window, create a patch-dense sphere, and center it a little bit under your plane. Make sure that the normals of the grid are facing down and those of the sphere are out. Also, it should have its own bone that is not parented to the grid’s bone. Back in your action, you will have to delete a few things before proceeding. The Cloth sim tends to “remember” its previous state, so it’s always better to delete and start over. You’ll have to delete the Action Objects folder and the Splines folder. The Splines Folder contains constraining information of which CP goes to which Mass and if we create a new Spring System, it’s possible that the Masses will be renamed, and a new Spring System will distort the Mesh. In 10.5 an actual object has been created under the Objects heading in the Project WorkSpace (whereas in 8.5 there is only an Action Object). You should delete this as well.

Before you run another simulation, you should extend the animation just a little bit longer. Make a key frame of the grid plane moving or rotating at Frame 100.

Go back to frame 0 and run the simulation. Here’s my result:

The Cloth Group interacting with another object.

The grid still falls, but now it interacts with the sphere, draping itself over it before slipping off and falling into oblivion. All in all, the motion is quite nice, with some problems. Of course, it still does not react to the bone motion in the slightest, but we have learned one method to effect its motion – we can surround it with other objects that’ll influence where it goes. Of course, the motion isn’t really satisfactory, and remains problematic for a pretty basic reason. Notice how after the grid lands on the sphere, parts of the grid have fallen into the sphere. It is this kind of interpenetration that is so important to avoid in computer graphics. Worse still, if you look carefully at the last few frames, it seems to fling itself off the sphere, which is not at all how a real piece of cloth would slide off something. It should not gain momentum from having fallen onto something.

The reason why this happens and what makes interpenetration so very bad when it comes to AM Cloth is because it looks to collide with CPs. When a Mass encounters a CP, it will react to it based on a range of influence you can set in the Properties. However, if it doesn’t encounter a CP, but only a spline or patch, it will simply fall straight through as though nothing were there. This presents a difficulty as one of the great strengths of Hash patches is making lightweight geometry for our characters. Worse still, it can happen that the Cloth falls through one part of the model, but then gets stuck inside when it encounters a CP on its way back out. This is why my Cloth flings itself away from the sphere – as it’s sliding off, a few Masses have been caught inside the Sphere, which then cause the springs to which they’re attached to stretch and gain energy. When they’re finally liberated from the sphere, their springs contract with the force that they have gained, which is considerably more than you would have expected.

The only real way of dealing with this is simply making denser meshes. Most of the time, this will be an overly difficult solution to implement as it not only requires that we forego AM’s chief modeling advantage and possibly rebuild our entire model, but it still offers no guarantee that the Cloth won’t fall through the mesh. It amounts to something of “Hail Mary” solution.

We could add Forces to help control the Cloth, but it similarly carries no such guarantee. Mesh density and Force solutions are very indirect ways of influencing the behavior of the Cloth and thus can yield unpredictable results. A more direct method is preferred.

The first is the old-fashioned way. Look at the Action after you’ve run a simulation. Expand the Action Objects Folder, then the Spring System Action Object, and then the Masses. A keyframe has been made for each of the Masses at every frame. So, in principle, you could find the areas that aren’t what you want them to be, and simply move the appropriate Masses (moving CPs in Muscle Mode won’t have any effect – but you can translate the Masses by hand). This is extremely difficult and tedious since there is one keyframe at every frame for every Mass, so you would have to do a lot of tweaking to get better results. Still, it is possible.

The second deserves closer attention, as it will be the method to ultimately employ for controlled Cloth movement: Parts of the mesh that are not part of the Cloth group.