Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tearable Cloth on a Character
#1
So I understand that skinned cloth cannot be tearable, which is unfortunate as I was hoping for that in my use case. I am running a simulation where you have a patient, and if they have an injury you would cut the clothing off of the injured body part. From what I understand from the videos the reason that clothing is simulated with skinned meshes is because if the character moves suddenly they would probably lose the clothes.

In a use case where the character will not be moving fast or often, and behaving more like a mannequin, would it be a reasonable use case for a tearable cloth?

Thanks!
Reply
#2
(26-11-2020, 10:58 PM)arkanis Wrote: So I understand that skinned cloth cannot be tearable, which is unfortunate as I was hoping for that in my use case. I am running a simulation where you have a patient, and if they have an injury you would cut the clothing off of the injured body part. From what I understand from the videos the reason that clothing is simulated with skinned meshes is because if the character moves suddenly they would probably lose the clothes.

In a use case where the character will not be moving fast or often, and behaving more like a mannequin, would it be a reasonable use case for a tearable cloth?

Thanks!

Hi Arkanis,

Character cloth simulation in games is usually performed by constraining cloth vertices within a certain radius from their skinned position, and to the outer hemisphere of the skinned surface (using the skinned normal vector). This is the method used for character cloth in all commercial games, and it has a double function:
  • There's no need to perform collision detection against the character's body: particles can't get inside the character body because they can only move "outside" of the skinned cloth mesh. So as long as the skinned cloth does not intersect the body, the simulated cloth won't either.
  • Since there's no collision detection going on, we entirely get rid of tunneling (missed collisions when the character moves suddenly). Win-win.

Sometimes, this is method coupled with a few primitive colliders (mostly spheres or capsules) to prevent very loose clothing (such as capes or long scarfs) from clipping against certain parts of the character.

So tunneling isn't the only (or main) reason behind using skinned meshes: performance is. Detecting contacts against a mesh is prohibitively expensive: Each particle can potentially collide with any triangle of the mesh, so to avoid having to check every triangle in the body mesh against every particle in the cloth (which is a lot of triangle/ray intersections), meshes are usually pre-processed once and inserted in a data structure that allows to quickly prune triangles that are very far away from a given particle, so we don't have to check all triangles for each particle. The structure used is typically a BVH or a variant of it (a BIH in Obi's case).

However when the mesh itself can deform/change its shape at runtime, you're forced to either revert to the naive "all particles vs all triangles" method, or to update the BVH every frame which can be even more expensive than the naive method.

For this reason, deformable MeshColliders aren't a thing in Unity (less so in Obi). Technically you can force a MeshCollider to update its shape every frame, but this is really costly as I mentioned earlier.

Unfortunately, direct cloth vs deformable mesh collision remains doable only in GPU (a really powerful one), and at most with 1 character on screen. Obi just isn't intended for this use case.
Reply
#3
(27-11-2020, 08:48 AM)josemendez Wrote: Hi Arkanis,

Character cloth simulation in games is usually performed by constraining cloth vertices within a certain radius from their skinned position, and to the outer hemisphere of the skinned surface (using the skinned normal vector). This is the method used for character cloth in all commercial games, and it has a double function:
  • There's no need to perform collision detection against the character's body: particles can't get inside the character body because they can only move "outside" of the skinned cloth mesh. So as long as the skinned cloth does not intersect the body, the simulated cloth won't either.
  • Since there's no collision detection going on, we entirely get rid of tunneling (missed collisions when the character moves suddenly). Win-win.

Sometimes, this is method coupled with a few primitive colliders (mostly spheres or capsules) to prevent very loose clothing (such as capes or long scarfs) from clipping against certain parts of the character.

So tunneling isn't the only (or main) reason behind using skinned meshes: performance is. Detecting contacts against a mesh is prohibitively expensive: Each particle can potentially collide with any triangle of the mesh, so to avoid having to check every triangle in the body mesh against every particle in the cloth (which is a lot of triangle/ray intersections), meshes are usually pre-processed once and inserted in a data structure that allows to quickly prune triangles that are very far away from a given particle, so we don't have to check all triangles for each particle. The structure used is typically a BVH or a variant of it (a BIH in Obi's case).

However when the mesh itself can deform/change its shape at runtime, you're forced to either revert to the naive "all particles vs all triangles" method, or to update the BVH every frame which can be even more expensive than the naive method.

For this reason, deformable MeshColliders aren't a thing in Unity (less so in Obi). Technically you can force a MeshCollider to update its shape every frame, but this is really costly as I mentioned earlier.

Unfortunately, direct cloth vs deformable mesh collision remains doable only in GPU (a really powerful one), and at most with 1 character on screen. Obi just isn't intended for this use case.

It's unfortunate that it is not possible, but I understand it is a technological bottleneck to do so. Thankfully, I have a fallback idea that doesn't involve cloth simulation for the task.
Reply