It's free to join Gamasutra!|Have a question? Want to know who runs this site? Here you go.|Targeting the game development market with your product or service? Get info on advertising here.||For altering your contact information or changing email subscription preferences.
Registered members can log in here.Back to the home page.

Search articles, jobs, buyers guide, and more.

by Jeff Lander
Gamasutra
March 27, 2000

This article originally appeared in the
May 1999 issue of:

Printer Friendly Version
Jeff Lander's Discussion Forum

 

Letters to the Editor:
Write a letter
View all letters


Features

Contents

Introduction

The Latest Springy Fashions

Problems to Avoid and Ignore

Problems to Avoid and Ignore

The simulation has a couple of problems. The first is that the way to simulate cloth realistically is to use a lot of points in the simulation. This takes more computation time. High-end animation programs rely on a great number of particle points for realism. Of course, in other fields, hour-long render times are perfectly acceptable. In a real-time game, however, this won’t get you on the cover of any game magazines. You have to sacrifice realism for speed. This is another good area for scaling game performance. If the system is running quite fast, subdivide the cloth patches a little more. Game players with a white-hot system should have smooth-looking cloth.

Another problem is that each spring acts independently. This means that each spring can be stretched to a great extent. In many cases, the amount of stretch can exceed 100 percent. This is not very realistic. Actual fabric will not stretch in this manner. The problem I have is that I am using linear springs when fabric actually displays a nonlinear spring behavior. As the amount of stretch increases, the strength of the spring increases also. The fabric will also stretch to some limit and then if the force continues, it will rip. This is not what I want (at least for now). This issue, which Xavier Provot (see For Further Info) calls “the Super-Elastic Effect,” is difficult to handle. Increasing the spring strength dynamically can lead to instability problems just like any other stiff spring problem. Provot suggests checking the amount of stretch in each spring, and if it exceeds a set deformation limit, the springs are adjusted to achieve this limit. While I agree this solves a definite problem, a second pass through the springs is costly. For the effects I have attempted to achieve, I can live with super-elastic cloth.

My collision system is pretty primitive. To make things easy, I only collide the vertices of the mesh with the objects. As it stands, if a sphere is small or the fabric stretches too much, the sphere will pass right through it. I also don’t handle self-collisions. That is, the fabric can pass through itself without penalty. This could be corrected by placing bounding spheres at each vertex. However, applying the sphere collision test between each vertex gets expensive. So, I just limit the situation so that either the cloth doesn’t pass through itself, or so the effect isn’t too noticeable.

Taking It to the Limit

Once the system is working, it’s fun to see how it can be extended. I mentioned the issue of tearing and ripping after the fabric stretches too far. I can monitor the spring lengths. If they exceed a limit, the spring can be removed from the system, effectively tearing the fabric. I think this would be a great way to simulate a cannonball tearing through the mainsail of a tall ship. This same method of breaking a spring would work for a simulation of a rope as well. After all, a rope is really just a one-dimensional version of the cloth patch.

Another dynamic effect can be achieved by manipulating the flexion springs. With these springs in place, the fabric will resist folding. However, if I selectively delete one of these springs, the fabric will be able to fold nicely where the springs are missing. I don’t know where I can use that yet, but I’m sure I can find a way.

The Application

The application this month was actually pretty easy to build. It’s essentially the same as last month’s application, but with a few additions. There’s a function that creates the cloth patch in a sort of macro fashion. You can set the spring settings for the three types of springs. You can also drop some collision objects around and watch them interact. Find the application and the source at http://www.gdmag.com.

Acknowledgements: Special thanks to Chris Hecker of Definition 6 and Rob Wyatt of Dreamworks SKG for discussing the issue with me.

For Further Info:

• Provot, Xavier. “Deformation Constraints in a Mass-Spring Model to Describe Rigid Cloth Behavior,” Graphics Interface, 1995, pp. 147-155. Also available in electronic form at http://www-rocq.inria.fr/syntim/research/provot

• Baraff, David and Andrew Witkin. “Large Steps in Cloth Simulation,” Proceedings of SIGGRAPH 1998, ACM SIGGRAPH, pp. 43-54. There are also fabric simulations available for many professional 3D animation packages available either as plug-ins or integrated into the software. I do not know what techniques these products use with the exception of one. Colin Withers of Topix created a fabric simulation for Softimage based on the Provot paper. Graciously, Topix released the source code for this plug-in to the public. See http://www.topix.com for more info.

Bio: Jeff Lander prefers to wear comfortable loungewear when hanging out writing code at Darwin 3D. Drop him a note and let him know what the fashion conscious are wearing this spring at jeffl@darwin3d.com.

________________________________________________________

[Back to] Introduction


join | contact us | advertise | write | my profile
news | features | companies | jobs | resumes | education | product guide | projects | store



Copyright © 2003 CMP Media LLC

privacy policy
| terms of service