Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to collide the cloth with the character?
#1
I want to have a loose skirt hanging from the waist of a character, and I want the animation of the character, especially the legs, to move the skirt from the inside.

It is not necessary for this to work in real time, as I will export the resulting animation for later playback in real time.

So I tried Option 1, which is to put an Obi Cloth in the skirt mesh, which locks the triangles in the waist very well, but I can't seem to correctly remove the bone influences so the rest of the cloth can move completely independent of the bones.

Then I tried Option 2, which is to have a non skinned mesh of just the skirt, as a child of the character pelvis. I then pin the vertices in the waist, and this gives a relatively good result, before collisions.

So now to add collisions, I first tried approximating the shape of the legs with capsule colliders, but either they're too thin, and the cloth intersects with the leg mesh, or they're too fat and the cloth bulges incorrectly.

Then I tried instead of capsule colliders, create an editor script that creates a small sphere collider at the center of each triangle in the leg mesh (remember I don't need this in real time), with a script that relocates the collider each frame to the skinned position of each triangle, but for some reason the cloth seems to completely ignore the colliders.

For most accuracy, I also tried creating mesh colliders, one for each triangle (as a prism to ensure the resulting mesh is convex), and updating them to relocate the resulting mesh each frame. Again, the cloth seems to ignore the colliders.

What would be a good way to achieve my goal of having the cloth pushed by the legs in the inside?
Reply
#2
(20-01-2018, 06:46 PM)panda_pajama Wrote: I want to have a loose skirt hanging from the waist of a character, and I want the animation of the character, especially the legs, to move the skirt from the inside.

It is not necessary for this to work in real time, as I will export the resulting animation for later playback in real time.

So I tried Option 1, which is to put an Obi Cloth in the skirt mesh, which locks the triangles in the waist very well, but I can't seem to correctly remove the bone influences so the rest of the cloth can move completely independent of the bones.

Then I tried Option 2, which is to have a non skinned mesh of just the skirt, as a child of the character pelvis. I then pin the vertices in the waist, and this gives a relatively good result, before collisions.

So now to add collisions, I first tried approximating the shape of the legs with capsule colliders, but either they're too thin, and the cloth intersects with the leg mesh, or they're too fat and the cloth bulges incorrectly.

Then I tried instead of capsule colliders, create an editor script that creates a small sphere collider at the center of each triangle in the leg mesh (remember I don't need this in real time), with a script that relocates the collider each frame to the skinned position of each triangle, but for some reason the cloth seems to completely ignore the colliders.

For most accuracy, I also tried creating mesh colliders, one for each triangle (as a prism to ensure the resulting mesh is convex), and updating them to relocate the resulting mesh each frame. Again, the cloth seems to ignore the colliders.

What would be a good way to achieve my goal of having the cloth pushed by the legs in the inside?

Option 1 is your best bet. Increase the particles' "skin radius" value to ensure they are not too heavily influenced by the bone animation. See:
http://obi.virtualmethodstudio.com/tutor...aints.html

You can also combine it with regular colliders (capsule or sphere colliders) to ensure proper behavior. Make sure that the collision layers/phases are properly set up:
http://obi.virtualmethodstudio.com/tutor...sions.html

Also remember that by adding a ObiParticleRenderer component to your cloth, you can see the particle representation used for cloth collisions. This is very useful to tune/debug collisions:
http://obi.virtualmethodstudio.com/tutor...ering.html

Anyway, how do you plan on exporting the animation afterwards? keep in mind that Obi does not include any import/export functionality for cloth animation, so you will have to roll your own. Imho, a much better/faster workflow for animated cloth is to simulate the cloth using an offline-sim (Maya's nCloth, Blender's cloth, etc) directly inside your 3D animation package, then export that. Obi cuts a lot of corners to achieve realtime performance, so the cloth simulation quality obtained from a non-realtime simulator will always be much higher.

Since you're exporting it anyway, I see no reason to use a realtime simulator for this -unless you intend your application/game to include both the baking and the playback parts of the pipeline (that is, allow your users to bake their own simulation and then play it back)-

cheers!
Reply
#3
(20-01-2018, 07:23 PM)josemendez Wrote: Option 1 is your best bet. Increase the particles' "skin radius" value to ensure they are not too heavily influenced by the bone animation. See:
http://obi.virtualmethodstudio.com/tutor...aints.html

Also remember that by adding a ObiParticleRenderer component to your cloth, you can see the particle representation used for cloth collisions. This is very useful to tune/debug collisions:
http://obi.virtualmethodstudio.com/tutor...ering.html

Anyway, how do you plan on exporting the animation afterwards? keep in mind that Obi does not include any import/export functionality for cloth animation, so you will have to roll your own. Imho, a much better/faster workflow for animated cloth is to simulate the cloth using an offline-sim (Maya's nCloth, Blender's cloth, etc) directly inside your 3D animation package, then export that. Obi cuts a lot of corners to achieve realtime performance, so the cloth simulation quality obtained from a non-realtime simulator will always be much higher.

Since you're exporting it anyway, I see no reason to use a realtime simulator for this -unless you intend your application/game to include both the baking and the playback parts of the pipeline (that is, allow your users to bake their own simulation and then play it back)-

cheers!

My programming skills are much more developed than my modeling skills. I have absolutely no problem in creating my own exporter. In fact, I'm using Unity just to simulate the clothes so I can then put it into the real game engine which will actually run the game.

There are so many things I can do programming, so none of these are actually issues.

On the other hand, I can just use Blender to view a model, and that's it. Not only I would need to learn all there is to know about Blender to be able to simulate this inside Blender (I also have to confess I have had very little luck correctly importing the 3D models I get into Blender, which are made in 3D Studio Max, so I'd have to solve that as well), I would also have to learn how to make an exporter for the data, or create an importer for whatever data Blender gives me. I estimate the learning curve for all of this is in terms of months, if not years.

On the other hand, my 3D person is knowledgeable in modeling and rigging, but not in everything there is to know about their software. I'd rather keep them focusing on the models, since there are so many models to make, and I focus on getting the cloth working.

Anyways, I just need the simulation to be "good enough", which is "follows the character and doesn't self intersect". I have faith in Obi Cloth for this.

Going back to the topic, should I assume that the particles shown by the particle renderer are virtual spheres, and that parts of the mesh that are not covered in particles are effectively not going to collide with anything? If so, how can I increase the amount of particles?
Reply
#4
(20-01-2018, 07:41 PM)panda_pajama Wrote: Going back to the topic, should I assume that the particles shown by the particle renderer are virtual spheres, and that parts of the mesh that are not covered in particles are effectively not going to collide with anything? If so, how can I increase the amount of particles?

Hi!

Collision detection between deformable meshes is only tractable in realtime using simple primitives (triangle-triangle collision detection is too expensive for deformable meshes).

Being a particle-based simulation engine, Obi uses a particle centered at each vertex of the cloth mesh. So in order to increase the amount of particles, you need to use a denser mesh. Note that you can also edit the radius of each individual particle using the particle editor:

http://obi.virtualmethodstudio.com/tutor...iting.html

cheers!
Reply