Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Basic SDF implementation for skinned cloth
#4
(11-11-2024, 10:17 PM)AdamZ101 Wrote: That makes it easier. Where do I plug in the distance field into my skinned cloth? I tried using the Obi Collider script and added my SDF, but I'd like the SDF to update in realtime based on the animation.

Adding the SDF to the ObiCollider component is the correct thing to do.


Quote:but I'd like the SDF to update in realtime based on the animation.

Updating an SDF is an extremely expensive operation. This is not what you'd typically do unless you're baking it in the GPU and the SDF is quite low-resolution. For instance, Unity's MeshToSDF is fast enough for realtime use with resolutions of 32^3 to 128^3, which are not nearly enough for accurate cloth collision detection against a human body (you'd need at least 512^3). VFX Graph's SDF baker also warns you about this:

Quote:Note that baking an SDF is a resource-intensive operation. If you need to bake an SDF every frame, it is best practice to use a low resolution.

Instead, use multiple convex (or nearly convex) SDFs and parent them to the character's bones, similarly to what you'd usually do for regular character hitboxes in most games. This requires no updates whatsoever so it's completely free in terms of performance and for most use cases results will be indistinguishable from updating a whole-body SDF. I wrote a quite detailed description of this approach's strengths and weaknesses in this thread.

kind regards,
Reply


Messages In This Thread
RE: Basic SDF implementation for skinned cloth - by josemendez - 12-11-2024, 08:44 AM