Not logged in, Join Here! or Log In Below:  
 
News Articles Search    
 


Submitted by Jordan Isaak, posted on March 23, 2002




Image Description, by Jordan Isaak



These two pictures are from a cloth simulation that I wrote a couple weeks ago. Gravity, air resistance, wind, and cloth-sphere collisions are simulated.

The cloth is represented as a grid of particles, which is updated via Verlet integration. After the grid of particles is updated, the simulation tries to satisfy a set of constraints between particles, which is what keeps the whole system from falling apart. This method is described by Thomas Jakobsen in his GDC 2001 paper, "Advanced Character Physics."

Wind is simulated by finding the dot product between each particle's normal and using that value to scale the amount of force that the wind applies to that particle. The wind force is applied along the particle's normal. Air resistance is calculated in a similar way.

Cloth-sphere collision is handled by checking to see if a point falls within the sphere, and projecting it out to the sphere's surface if it does.

A demo can be found at http://members.shaw.ca/jdisaak/graphics.htm

In the demo, the cloth has a resolution of 16x16 points, and the simulation is updated every hundredth of a second. It should run fine on a PII 300 or anything better.

Jordan Isaak


[prev]
Image of the Day Gallery
www.flipcode.com

[next]

 
Message Center / Reader Comments: ( To Participate in the Discussion, Join the Community )
 
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
 
Division By Zero

March 23, 2002, 05:29 PM

I think its definitely worth a comment ....
Am I wrong ?

 
Udderdude

March 23, 2002, 05:31 PM

It looks pretty cool, I like the effect of moving the sphere into the cloth. Very natural. Source code would be nice though ;)

 
KieranIsOK

March 23, 2002, 05:36 PM

That is most certainly the best implementation of verlets that I have seen! (apart from in Hitman, of course)
Fantastic! I bow to you sir!

 
davepermen

March 23, 2002, 05:50 PM

one of the most stable cloth-simulations seen yet.. good work, really good work

 
Roch Denis

March 23, 2002, 06:18 PM

Interesting work it looks ver well done, I'd been meaning to try out cloth simulation for a while too. I think I'll start out when I finish my current project ^_^.

 
Warren Marshall

March 23, 2002, 06:24 PM

If someone doesn't post an EXE, people whine for it. If they DO post an EXE but not the source, people whine for the source.

Next it'll be whining because the author hasn't merged his code into your engine for you. :)

 
Tristan

March 23, 2002, 06:38 PM

Looks interesting.

Where can I find this paper? (I mean "Thomas Jakobsen in his GDC 2001 paper, 'Advanced Character Physics.' ")

Really nice job!

 
davepermen

March 23, 2002, 06:42 PM

http://www.ioi.dk/Homepages/tj/publications/gdc2001.htm

google. first hit..

 
Badgers

March 23, 2002, 06:42 PM

That's a damn nice cloth simulation indeed, Jordan! It looks very smooth, and the poly count is low enough for something like this to be implemented in a game. I recall seeing cloth simulation used in Metal Gear Solid 2, and it looked absolutely great. It'd be cool to put some nice texture on your cloth, set up a simple scene and make it behave like they did in MGS2 ie. strong winds, a cloth attached with ropes covering a pile of boxes and you could shoot the ropes off one by one until the cloth would fly away and interact with the rest of the scene. That would definitely look impressive enough to get a wow from practically anyone.

Collision with self would be one other feature (apart from a more appealing setting) I'd definitely like to see. That might pose some issues, not sure though, haven't looked into that. Very nice work, keep it up!

 
ghost007

March 23, 2002, 07:09 PM

holy f*** =D

That is very cool looking. From your expertise on the program, how much CPU time is allocated to calculating those movements? Significant or no?

Again, that's some kickarse stuff. I really love seeing physics being applied in games/apps.

 
Cybersled

March 23, 2002, 07:21 PM

Now that comment doesnt make any sense.

 
Timothy Barnes

March 23, 2002, 09:13 PM

That was very smooth on my computer. 550-MHz P3 with an Intel i820. I don't game very often anymore so it's sufficient.

 
bigcheese

March 23, 2002, 10:14 PM

Or they're complaining that glut32.dll wasn't included. Damn, glut32.dll wasn't included. Always a pain.

 
jdi

March 23, 2002, 11:14 PM

ghost007:
I tried running the cloth sim doing updates every thousandth of a second on my PIII 700, and it ran in real time. Any more and it fell behind. It should also be noted that I attempt to satisfy all the constraints between the particles three times every frame in the demo, which helps to reduce the amount the cloth sags, so it doesn't look like it's loose spandex or something like that.

I haven't really optimized it, though. There's one square root per constraint that is possible to optimize out, but I haven't bothered to because I'm not planning on using this code for anything else.

Jordan Isaak

 
zed zeek

March 24, 2002, 12:23 AM

sure beats those flags in quake3/unreal tournament

 
Warren Marshall

March 24, 2002, 12:25 AM

It does if you read/understand English. ;)

 
CGameProgrammer

March 24, 2002, 01:38 AM

It can't possibly be a pain more than once. You should install your glut32.dll to the C:WindowsSystem[32] directory and that will be enough.

 
Max

March 24, 2002, 01:44 AM

glut32.dll is included.

Max

 
matt benic

March 24, 2002, 01:57 AM

Very kewl. I absolutely love spring/cloth dynamics and this is definitely one of the nicest looking implementations I've seen.. agree with udderdude tho, sourcecode would be nice (even partial.. )

 
Jari Komppa

March 24, 2002, 04:02 AM

If someone doesn't post an EXE, people whine for it. If they DO post an EXE but not the source, people whine for the source.

Actually, sometimes people whine for a demo even if it's available =)

Oh well..

Maybe the IOTD should have clear information form with stuff like

Demo: available here
Sources: Not available (commercial).

 
Rasmus Christian Kaae

March 24, 2002, 04:13 AM

Hehe, this is quite funny :-) Maybe some collisiondetecion on the cloth itself would be neat.

 
YvL

March 24, 2002, 07:02 AM

That would be very useful.
Tho you should remember, that this is an IMAGE of the day...

 
Kyoko-san

March 24, 2002, 07:30 AM

Great work.

Not that this isn't good, but I like the previous one where if you keep the wind blowing the cloth would actually fall onto the ground

Anyways, is there any paper / articles I can read about the theory behind cloth animation?

 
DirtySouthAfrican

March 24, 2002, 07:37 AM



Hey that's pretty cool!

 
DirtySouthAfrican

March 24, 2002, 07:39 AM



That was a joke.

 
Tobias Franke

March 24, 2002, 08:09 AM

Take the clothes of baby, they suck! :)

 
Genu

March 24, 2002, 10:36 AM

This is just too great for me. Do you plant to make your source code available? You should do a tutorial on nehe.gamedev.net about this stuff.


Amazing work,
louis

 
Wim Libaers

March 24, 2002, 10:58 AM

You might as well give up, that picture is no match for the IOTD.

Yes, that's right DSA, some people object to this visual pollution of the forum. Or perhaps you didn't notice that Kurt already asked you to stop doing that?

 
jdi

March 24, 2002, 12:09 PM

In response to the people who have asked for source code, I have posted the source on the same page that the demo is on.

Be warned that there are very few comments in the code, because I didn't originally plan on releasing it.

 
Cybersled

March 24, 2002, 12:31 PM

good idea

 
This thread contains 39 messages.
First Previous ( To view more messages, select a page: 0 1 ... out of 1) Next Last
 
 
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.