Discussion
Back to Main... |
Let me begin by saying that cloth tearing is HARD. Making a simple square cloth modeled by a mass spring system is not that difficult, especially is you use a cheesy Euler step method to solve the system. So when you render the system, it shows up a a 2D grid of particles that look like they are moving "like cloth." Then, you have to render the cloth with some type of mesh. I chose to render the cloth using 2 triangles to form a square among 4 adjacent particles. This is for sure not the best way to do it, but it looks pretty cool, especially when you assign a random color to each vertex. Initally, I wanted to do a real-time simulation. This, however, proves to be a bit taxing on the processor for a more realistic cloth (> 40x40 particles). I have an interactive demo that is 10x10 particles. It proves its point, but doesn't look that much like real cloth. Or maybe it does, you can be the judge. After I did the initial cloth, I started to work on tearing. This has proved to be a very difficult task. My first instinct was to check the length of each spring and compare it to its resting length. If the spring stretched too far, it will break. This turned out to be the first thing that I impelmented. It sort of works... The problem is that if I tack one corner of the cloth down and pull on another corner, trying to tear the fabric, it breaks right in the corner. This demo is pretty cool, but it wasn't what I wanted. I needed control over small, localized parts over the cloth, so I implemented particle-cloth intersections and used my particle as a cloth "zapper" ("ripper", "tear-er", whatever you want to call it). When you touch the zapper to the cloth, it appplies a force normal to the surface of the particle at the intersection point. If this force is strong enough, the spring will break, and gives the appearance of tearing cloth. After playing with this for a while, I noticed that sometimes, even though a piece of cloth had been cut completely in half, it would be hanging on by some invisible thread. So....I decided to render all of the threads so that when half of the cloth was hanging by a thread, it would actually look like it. This is a cool effect when the cloth is torn. However, it is annoying to have it in the way when the entire cloth is there. Oh well, I am only one person, with not that much time. Also, I wanted to do some method of solving the equations other than using Euler steps, but I never got to it. I'm sure it would have made for a way better project, but I opted to use really small time steps instead. While this works ok, it makes for really slow simulations. Another thing to note is that I am not preserving the entire mass of the cloth. To actually do that, I would have needed to have an entirely different structure for my system. My simple 2D array would not have allowed me to easily integrate more particles into the cloth as it was in the process of tearing. I would have liked to do this, however, I didn't want to rewrite all of my code at the last minute. Knowing what I know now, I would start with a different framework for the cloth. |