🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Cloth physics - generate constraints for arbitrary mesh

Started by
3 comments, last by OCASM 4 years, 5 months ago

Is there a general algorithm to solve that problem?

For a simple plane I just add all triangle edges as distance constraints. That works fine. For other meshes however, say a simple uv sphere made in Blender, the algorithm is completely broken due to extra vertices created during the export process. All the papers I've seen on cloth / soft body physics talk about how to solve the constraints but not how to generate them in the first place.

Any help would be appreciated.

Advertisement

For best results you probably have to remesh the models so the triangles / quads have more uniform area and angles.

This is a good tool: https://github.com/wjakob/instant-meshes It can generate equilateral triangles, quaddominant, and pure quadrangulation (using subdivision).

Quad meshes allow to add extra joints along diagonals and along two edges (skipping one vertex in between). This way you could control sheer / bend / stretch resistances in a simulation individually. (But at singularity vertices the regular quad structure breaks of course.)

…as you also mention softbodies, this one seems good for volumes: https://github.com/Yixin-Hu/TetWild

And AMD recently released a FEM softbody library, there myust be something similar her too: https://gpuopen.com/gaming-product/femfx/

Thanks for the resources!

I found a thread on the Bullet Physics forums talking about the issue as well:

https://pybullet.org/Bullet/phpBB3/viewtopic.php?t=10154

For now I just find all the repeated vertices (by comparing positions), ignore them during the constraint creation and solver phases and just copy the values of the “original” vertices to the duplicates at the end of each frame. I'll certainly have to deal with remeshing when I implement tearing though.

Since I'm dealing with triangle meshes for now I make bend constraints by finding triangles that share an edge and then connecting the unshared vertices.

This topic is closed to new replies.

Advertisement