Animated cloth simulation on avatars
alelordelo opened this issue · 9 comments
Would it be possible to use the simulation on animated avatars?
Hi,
There is no theoretical constraint for running the system for animated avatars. The forward simulation paper used by Diffcloth in fact shows a demo for animating avatars (https://hal.inria.fr/hal-02563307v2/document Fig 4). In terms of the code base, a collision detection algorithm for arbitrary exeternal mesh needs to be implemented. A relating comment is here.
I'm quite interested in Animated cloth simulation on avatars.
I have some knowledge of the VRM portable avatar format and workflows for obj sequences to alembic to dem_bones to gltf.
In my other pr I posted notes for Windows support. I may be able to submit for prs for Windows support.
It would help if you can describe more notes or plans, so I can try implement animated cloth simulation on avatars.
I work in the open, so I can post pull requests to this repo.
Hi Fire,
I think the first step towards animated avatars is just assuming the body avatars are inputed as an obj file with normal provided. Then what's lacking in the current code base is support for an arbitrary mesh collision detection algorithm. I think a MeshObject needs to be added to the Primitive Class. And the isInContact() function needs to be implemented, which takes in a cloth vertex and returns whether it is in collision with the mesh, and if so what is the distance to the mesh and normal of the collision. One possible implementation is to use the algorithm in this document: https://graphics.stanford.edu/courses/cs468-02-winter/Papers/Collisions_vetements.pdf The first step would be to implement point-triangle collision detection for every triangle in the body mesh. But this likely will be slow for large body meshes, so an acceleration structure needs to be implemented as a second step to skip unnecessary point-triangle collision queries, possibly BVH (sec 2.1)
Hi @fire and @omegaiota,
What @omegaiota is describing is totally accurate.
Collision detection
We have implemented avatar and cloth physics, and you basically need a robust collision detection system that could be triangle vs triangle(more accurate, slower) or particle vs particle ( less accurate but faster). I would be happy to contribute to this repo with our collision detection and BVH , but it's implemented in another language (Swift), and I am not skilled in C++ world.
Avatar
No special need here, any animated avatar should work (OBJ; DAE, etc).
Hi @fire and @omegaiota,
What @omegaiota is describing is totally accurate.
Collision detection We have implemented avatar and cloth physics, and you basically need a robust collision detection system that could be triangle vs triangle(more accurate, slower) or particle vs particle ( less accurate but faster). I would be happy to contribute to this repo with our collision detection and BVH , but it's implemented in another language (Swift), and I am not skilled in C++ world.
Avatar No special need here, any animated avatar should work (OBJ; DAE, etc).
If you have a working version of cloth-mesh code it would be very helpful to get a reference to it. I don't know if I'll get time to work on this yet but if I do, even if just being able to reference a Swift version implementation will be very helpful!
I have detached the simulation code from the game engine renderer. Also made the code work with cmake and ninja with mingw compilers. Also on Windows.
Want to try gluing the code to godot engine and trying avatar cloth physics.
I found https://github.com/fire/preconditioner-for-cloth-and-deformable-body-simulation as an accelerator, but I wasn't able to understand the minimizer solver.
Hi @alelordelo,
If you could provide the Swift code, I'd be happy to help with porting it. You mentioned two parts for this:
- Triangle vs Triangle: This method is more accurate but slower.
- Particle vs Particle: This method is less accurate but faster.
I can implement either of these methods in my differentiable_cloth branch.
Please note that I've removed some parts of the original code related to the game engine OpenGL and Python integration. Let me know if you need those parts as well.
Looking forward to your response!