Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Animated cloth simulation on avatars #10

Open
alelordelo opened this issue Nov 1, 2022 · 9 comments
Open

Animated cloth simulation on avatars #10

alelordelo opened this issue Nov 1, 2022 · 9 comments
Labels
Collision help wanted Extra attention is needed Simulation

Comments

@alelordelo
Copy link

Would it be possible to use the simulation on animated avatars?

@omegaiota
Copy link
Owner

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.

@fire
Copy link

fire commented Nov 1, 2022

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.

@fire
Copy link

fire commented Nov 1, 2022

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.

@omegaiota
Copy link
Owner

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)

@alelordelo
Copy link
Author

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).

@omegaiota omegaiota added the help wanted Extra attention is needed label Nov 8, 2022
@omegaiota
Copy link
Owner

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!

@fire
Copy link

fire commented Mar 5, 2023

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.

https://github.com/fire/differentiable_cloth/tree/stripped

@fire
Copy link

fire commented Mar 5, 2023

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.

@fire
Copy link

fire commented Aug 22, 2023

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Collision help wanted Extra attention is needed Simulation
Projects
None yet
Development

No branches or pull requests

3 participants