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

Submitted by goltrpoat, posted on August 15, 2000

Image Description, by goltrpoat

Here are some screenshots of something I've been playing around with recently. "Why has goltrpoat been playing with something that looks like a bunch of wet place mats?" you ask. Good question. One that I don't really have an answer for. It *is* rather addictive though, I coded the wireframe version of this thing in about an hour and a half and spent the next four hours playing with it. Anyway. This is a realtime cloth simulator, the patches you're seeing are about 20x20 quads with ~9 tension links per vertex. There are a couple of invisible objects in the scene, namely the ground, and a pretty big sphere that rolls (well.. drags) around the floor. The strange looking perturbations in the bottom two shots are the result of the sphere bumping into the cloth. All of the shots were taken with the cloth suspended by one edge, but it can be suspended by a corner, or a vertex in the middle of the cloth, or anything really. Doesn't have to be suspended to begin with. Surfaces can be made "sticky," i.e. if a surface touches the cloth, it'll drag it around with it. That means that technically I could drape a patch of cloth over a 3d model, turn stickiness off and have it run around with the cloth flapping in the wind. The cloth tears, although I haven't really figured out a good way to display that by means other than wireframe, since unless it displays the individual threads being torn off (which I get automatically in wireframe), it looks pretty fake. Well, that, is about it. Lemme know what you guys think.


Image of the Day Gallery


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.

August 15, 2000, 10:15 AM

Yeah it seems good:) and I liked the fact that you coded it in 1.5 hour and played with it during 4 hours:)

Alex J. Champandard

August 15, 2000, 10:23 AM

I have to confess I can see why you find these things so adictive... they're really fun to play with, and very cool to watch (what was that combat game on the PS/2 that did it?)

Have you tried using 16 springs per vertex? You get much more realistic results (the cloth seems much more rigid).

Another cool thing you could do with the stickiness is to simulate a scene where a woman in a white T-shirt gets splashed by some water... hehe ;)

As for the tears, you could just use a special texture, with visible threads of cloth in it, that you would progressively alpha-blend out. There must be a better way, but i can't think of any off the top of my head.

Anyway, have fun ;)


Carl Warwick

August 15, 2000, 02:00 PM

Couldn't you blend in some of the wireframe model when its tearing, this way you could see the tears. It might not work, but just an idea.


August 15, 2000, 06:27 PM

alex - yep.. tried it with 16 and 24 springs per vertex, but it doesn't seem to be terribly feasible to have more than 2-3 of these on the screen at the same time on a mid end machine (p2/300).. hopefully by the time i incorporate it into my engine i'll have a half decent computer tho :)

carl - yep, that's exactly what i'm considering doing..


"I think, therefore I'm right."

"Float like a butterfly, bite like a crocodile."


August 15, 2000, 07:13 PM

Cool stuff.

I'm interested in spring dynamics, are there any good online references to this subject? Thanks in advance.

Here's a challenge (like you need another one ;P) -
Could you create a cloth which was suspended by all four corners, and drop a ball down onto a point of the cloth, and have it roll inwards until it stopped?

(Just trying to stimulate).

"Blessed are the cheese makers..." - Life of Brian

Alex D'Angelo

August 15, 2000, 11:52 PM

There were a few article in Game Developer last year on creating cloth. You can probably find the articles on Gamasutra.


August 17, 2000, 11:56 AM

this would make a cool app to use as a plug-in for graphic editing apps, like Adobe Photoshop or Corel Photopaint. photo paint has a way to create textured fills but while it offers a lot of variety, you might have to play with settings for hours before it gives you what you want


August 18, 2000, 08:55 AM

textured fills? what are you talking about? :)

"I think, therefore I'm right."

"Float like a butterfly, bite like a crocodile."


August 19, 2000, 08:37 AM

Corel photopaint has a kind of fractal fill tool which lets you play with all kinds of params so that you can get different looking fills
(for bitmap images) example: ocean water let's you change the perspective, coloring of different parts of the water, choppiness/smoothness.
other examples are ringed paterns you can set the variation between ring sizes, how many rings, etc.

what I'm saying is: create a plugin that creates a still bitmap image of cloth in movement, and apply lighting effects, transparency, etc. and the result gets exported to the application as a separate object.

there are no plugins or separate applications that I know of that do that sort of thing

on the rips and tears:
- visualize your T-shirt with a rip in it
- note how the fabric stretches when you pull on it
- it has to stretch before it rips
- after it rips it snaps back to a normal tension
- there is a node at the point of the rip, the tension varies from 100% at the rip point to normal at a distance from the rip based on the fabric type
- have fun!

This thread contains 9 messages.
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.