Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cloth grab with skinned meshes?
#1
I'm trying to see if I can use OBI to allow for cloth grab on skinned characters. I've seen your proxies video which is a bit old, and it seems like that version of OBI Cloth only works with static meshes:
https://www.youtube.com/watch?v=IWXSJJAu...JQ&index=7

I stumbled upon this video which they claim that they using OBI cloth for their setup. And since it was posted 6 months ago I thought there might have been an update to OBI which allow that:
https://www.youtube.com/watch?v=mpKB8z-l...O1nHu2YBhQ

Any thoughts or suggestions of how to do that would be greatly appreciated. Thanks!
Reply
#2
(30-10-2024, 10:48 PM)AdamZ101 Wrote: I'm trying to see if I can use OBI to allow for cloth grab on skinned characters. I've seen your proxies video which is a bit old, and it seems like that version of OBI Cloth only works with static meshes:
https://www.youtube.com/watch?v=IWXSJJAu...JQ&index=7

I stumbled upon this video which they claim that they using OBI cloth for their setup. And since it was posted 6 months ago I thought there might have been an update to OBI which allow that:
https://www.youtube.com/watch?v=mpKB8z-l...O1nHu2YBhQ

Hi Adam,

This has always been doable in Obi, in fact there's a sample scene included ("CharacterCloth") that does just that. The only difference with the video you shared is that in our sample scene the cloth's upper body is not simulated but attached to the character's skeleton, so it cannot be fully undressed as in the reference video.

Also note that to be able to grab/drag cloth, be it skinned or not, you just need to use the ObiParticleDragger component.

(30-10-2024, 10:48 PM)AdamZ101 Wrote: it seems like that version of OBI Cloth only works with static meshes

Obi works with both static and dynamic objects, however it does not work with deformable meshes (meshes whose vertices can freely move in local space as a result of linear blend skinning or procedural deformation of any kind, be it done in the CPU or via vertex/compute shaders, etc).

Note that character cloth of the kind shown in the video does not require collisions against deformable/skinned meshes, that is, cloth directly colliding against the skinned character body mesh. Neither Unity nor Obi - or any other existing game engine for that matter - have built-in support for deformable mesh colliders. The reason is it's an impractical approach due to its extremely high runtime cost* and very low robustness**.

Most games' approach to accurate collision against moving character bodies is to simply parent non-deformable colliders to the bones in the character's skeleton. In many cases capsules are used (like on our CharacterCloth sample scene), however Obi also allows for SDFs (aka distance fields) for much better accuracy. The resulting collision detection is considerably more robust than the brute-force approach of colliding against skinned mesh triangles, at a small fraction of the cost, and generally indistinguishable from it.

There's downsides to this approach however: it requires manually setting up the colliders (or writing a script that does it automatically for you) and doesn't easily allow for blend shapes on the character's body or altering body proportions at runtime.

kind regards,

*The reason this is costly is that colliding against a mesh requires colliding against all its individual triangles. For cloth collision detection, all cloth vertices would have to be tested against all mesh triangles. In order to make this a tractable problem, spatial subdivision structures (BHV, BIH, Kd-Tree just to name a few) are often used to quickly prune triangles that are very unlikely to be involved in the collision, reducing the amount of collision tests. All these structures however assume the mesh triangles don't move relative to each other. As soon as you get rid of this assumption, the data structure needs to be either updated or completely rebuilt from scratch every frame, which is more costly than collision detection itself. As a result this is not practical for realtime use.

** The reason this is quite brittle and will often miss collisions is that collision detection relies not just on object positions but object velocities. Vertices store no velocity values, so deforming a mesh essentially teleports vertices from one frame of animation to the next. Given that triangles are infinitely thin - they have no volume - it's easy for them to teleport into the cloth and once this happens, cloth will be permanently stuck inside the body mesh.

On the other hand, using colliders that do have volume (capsules, sdfs) parented to the character's bones ensures cloth can be projected back outside it there's any missed collision, and the chances collisions are missed in the first place are smaller since it's easy and fast to calculate linear and angular velocities for each bone (Obi does this automatically for you).
Reply