New cloth simulation demo

Updated this demo with more springs between the nodes, so the cloth behaves better, though at a performance cost, a lot higher CPU load. Also added a standard GL path for those without GLSL, so it should run at all cards now, but with reduced quality for those without GLSL.

A little credit goes to Kristof since I finally got around to actually read the ShaderX book I have had some time and found his nice article about cloth simulation, so I used some of the tips there for how to set up the springs.
 
Would it be possible to execute the entire program (aside from api calls and basic ops) on the vpu, with reasonable performance?
 
Luminescent said:
Would it be possible to execute the entire program (aside from api calls and basic ops) on the vpu, with reasonable performance?

Yes, with the right API support. I'm hoping to see the super_buffers extension soon. Then I could just render to a texture and use it as a vertex buffer.
 
Btw, Humus, I think I noticed a flaw in your program. There doesn't appear to be any conservation of angular momentum.

That is, if there is a situation with one sphere, off-center, and the cloth falls on it, after contact it should be spinning. It's not, not at all.

Or, if there is no ball, and the cloth is held at two corners, just falls straight down, and doesn't swing back and forth. Of course, in the real world this will happen if there is very high friction, but I don't see why this should be the case.

Anyway, I hope that this is just a matter of tweaking a variable, but it doesn't seem right to me the way it's currently set up.
 
It's just that I have quite high friction, especially when there's contact with the balls. You can lower the friction and get the effect you're looking for more visible, but then unfortunately the chances of it getting unstable increases too.
 
Humus said:
It's just that I have quite high friction, especially when there's contact with the balls. You can lower the friction and get the effect you're looking for more visible, but then unfortunately the chances of it getting unstable increases too.

I think there could be a joke to be made of friction and balls, but it's way too early on Monday for that.

What causes the unstability? I'm guessing that the energy in the cloth as a system only increases, as gravity affects it, but energy is not lost at all in the springs, only in friction. Could something be done about the springs so that they aren't 100% effective, or something?
 
I've been thinking about a number of ways to solve it, but haven't found a good way yet. Part of the problem is that it's a discreet system, while reality is continuous. So if it's not sampled close enough in time problems can occur occasionally.
 
Instability is always a problem with cloth simulations because you basically use a number of very stiff stick/spring constraints to make a bunch of particles (the vertices in the cloth mesh) behave like a piece of cloth. This means the numerical integration you do becomes very unstable. The best bet for stiff equations is generally to use implicit integration but it's harder to implement and not very effective for moderately complex cloth like the one used in real time demos. It makes much more sense for offline animation.

There's an old cloth sim I wrote years ago available here which IMHO got the movement of the cloth pretty realistic. It still is a bit stretchy and jittery due to the crappy explicit integration method though. It has very uninspiring rendering but decent physics :)
 
Humus said:
I've been thinking about a number of ways to solve it, but haven't found a good way yet. Part of the problem is that it's a discreet system, while reality is continuous. So if it's not sampled close enough in time problems can occur occasionally.
Humus,
In the 2002 Siggraph proceedings there was a presentation that described a method of stopping these sort of instabilities. That might be worth a look. (Mind you, I tried (but failed) to convince Kristof to have a look at it for the PowerVR cloth sim so it might be too tricky to implement in a real-time system)
 
GameCat said:
There's an old cloth sim I wrote years ago available here which IMHO got the movement of the cloth pretty realistic. It still is a bit stretchy and jittery due to the crappy explicit integration method though. It has very uninspiring rendering but decent physics :)

Nice, but waaaaay to fast. You don't get a good sense of what's going on with no timing code and 1000+ fps. ;)
 
Simon F said:
Humus,
In the 2002 Siggraph proceedings there was a presentation that described a method of stopping these sort of instabilities. That might be worth a look. (Mind you, I tried (but failed) to convince Kristof to have a look at it for the PowerVR cloth sim so it might be too tricky to implement in a real-time system)

Found the doc, and it seems quite advanced at first glance. Gonna read it through though and see if I manage to get something useful out of it.
 
Humus said:
Nice, but waaaaay to fast. You don't get a good sense of what's going on with no timing code and 1000+ fps. ;)

Well, to my surprise it runs much faster now than it did on the 300 MHz Pentium II in 2000. ;) I vaguely remember putting framerate independent animation code in there, I'll see if I can update the demo.
 
Back
Top