Jump to content
  • Advertisement
Sign in to follow this  
yogr

Cloth tearing

This topic is 3161 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys! I'm developing a 2D engine just for fun and I'm implementing some simple physics. I added spring-mass support using fixed timestep and Verlet integration and everything is working like a charm (the simulation is very stable and I haven't found a way to make it explode yet). I then created a 2D cloth: every spring between two nodes has a minimum and maximum rest position, a max length threshold (if two nodes are too distant they are trated like a rigid joint). I recently added a tearing threshold: if the distance between two nodes is greater then the tearing threshold I simply remove the spring between these two nodes... my problem arises when I try to update my triangle mesh: the tearing feels quite unnatural and every removed node leaves big holes. Here's a screen of my cloth: the first two screens are my triangle mesh and my spring mesh (structural, shear and bend springs) while the last screen is the completely relaxed cloth after some time steps. cloth When I remove a spring between two nodes I simply remove all the triangles that contain that edge from the mesh... should I build a more taselated mesh or is my approach completely wrong?

Share this post


Link to post
Share on other sites
Advertisement
Your method is definitely flawed, but i am having trouble defining the ideal solution myself.

For starters, you dont want to remove any triangles ever. When the cloth tears it still has the same area (more or less) it just has different connectivity. So ultimately you're only going to want to break vertices and edges. That is where two triangles shared one edge before, those two triangles will now have unique edges. This will require adding new vertices too in some cases, when the vertices are no longer connected.

If you take a look at one of the squares. Image that it is torn along the diagonal of the graphic version (the perpindicular spring has exceeded the threshold). You dont want the two triangles there to disappear, you just want them to no longer share a common edge down the diagonal. If both diagonals are violated, then the graphic version must now be split into 4 triangles where there were only two before.

So basically you just want to add edges, vertices, and faces for the tear, not remove any.

Share this post


Link to post
Share on other sites
Yes you're completely right... the surface area should always be constant... that was my first (stupid) attempt, I'll try to find a better solution... thank you very much for your suggestion!

Share this post


Link to post
Share on other sites
What about this: when I have to break a spring I create two new Verlet nodes and two new springs connecting the new nodes with the old ones. Every triangle that shares the old edge will be broken in two new triangles.
For example if I break a shear spring (the diagonal) I create two new nodes, the old spring will be replaced by two new springs and the other shear spring (the other diagonal that it's not displayed in the picture) will be removed (and I think It should be replaced by 4 new springs...).





Won't the system become too expensive? Is there a better way?

I've heard about "tear lines", what are these?

Share this post


Link to post
Share on other sites
You could simplify the tearing by just making the breaking happen at the verticies.

If you can decide that a vertex is being torn, you can just replace that vertex with 2 with 1/2 the mass each attached to a subset of the original attachments. This avoids needing to create any more springs; the problem with inserting new springs may be that they need to be set up so as not to suddenly produce new forces.

Deciding which one is tearing could be done by adding up the magnitude of all the force vectors on a node and running a comparison with the magnitude of the resultant. The higher the ratio, the stronger the opposing forces are; put a threshold on that and you can tear the nodes which exceed that value.


Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!