New cloth simulation demo

Discussion in 'Architecture and Products' started by Humus, Dec 19, 2003.

  1. Humus

    Humus Crazy coder
    Veteran

    Joined:
    Feb 6, 2002
    Messages:
    3,217
    Likes Received:
    77
    Location:
    Stockholm, Sweden
    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.
     
  2. Luminescent

    Veteran

    Joined:
    Aug 4, 2002
    Messages:
    1,036
    Likes Received:
    0
    Location:
    Miami, Fl
    Would it be possible to execute the entire program (aside from api calls and basic ops) on the vpu, with reasonable performance?
     
  3. cthellis42

    cthellis42 Hoopy Frood
    Legend

    Joined:
    Jun 15, 2003
    Messages:
    5,890
    Likes Received:
    33
    Location:
    Out of my gourd
    Would it be possible for Humus to teach us how to be more cool--like him--than be less cool--like we are now? :wink:
     
  4. Humus

    Humus Crazy coder
    Veteran

    Joined:
    Feb 6, 2002
    Messages:
    3,217
    Likes Received:
    77
    Location:
    Stockholm, Sweden
    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.
     
  5. KimB

    Legend

    Joined:
    May 28, 2002
    Messages:
    12,902
    Likes Received:
    218
    Location:
    Seattle, WA
    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.
     
  6. Humus

    Humus Crazy coder
    Veteran

    Joined:
    Feb 6, 2002
    Messages:
    3,217
    Likes Received:
    77
    Location:
    Stockholm, Sweden
    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.
     
  7. Daliden

    Newcomer

    Joined:
    Sep 18, 2003
    Messages:
    89
    Likes Received:
    0
    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?
     
  8. Humus

    Humus Crazy coder
    Veteran

    Joined:
    Feb 6, 2002
    Messages:
    3,217
    Likes Received:
    77
    Location:
    Stockholm, Sweden
    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.
     
  9. GameCat

    Newcomer

    Joined:
    Aug 18, 2003
    Messages:
    185
    Likes Received:
    0
    Location:
    Stockholm, Sweden
    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 :)
     
  10. Simon F

    Simon F Tea maker
    Moderator Veteran

    Joined:
    Feb 8, 2002
    Messages:
    4,560
    Likes Received:
    157
    Location:
    In the Island of Sodor, where the steam trains lie
    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)
     
  11. gurgi

    Regular

    Joined:
    Jul 7, 2003
    Messages:
    605
    Likes Received:
    1
    You know what would be even cooler? A demo with a human model wearing cloth. :twisted:
     
  12. Humus

    Humus Crazy coder
    Veteran

    Joined:
    Feb 6, 2002
    Messages:
    3,217
    Likes Received:
    77
    Location:
    Stockholm, Sweden
    Nice, but waaaaay to fast. You don't get a good sense of what's going on with no timing code and 1000+ fps. ;)
     
  13. Humus

    Humus Crazy coder
    Veteran

    Joined:
    Feb 6, 2002
    Messages:
    3,217
    Likes Received:
    77
    Location:
    Stockholm, Sweden
    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.
     
  14. GameCat

    Newcomer

    Joined:
    Aug 18, 2003
    Messages:
    185
    Likes Received:
    0
    Location:
    Stockholm, Sweden
    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.
     
  15. Cyan

    Cyan orange
    Legend Veteran

    Joined:
    Apr 24, 2007
    Messages:
    8,572
    Likes Received:
    2,292
    please remove,want to move my post to console technology forum
     
Loading...

Share This Page

  • About Us

    Beyond3D has been around for over a decade and prides itself on being the best place on the web for in-depth, technically-driven discussion and analysis of 3D graphics hardware. If you love pixels and transistors, you've come to the right place!

    Beyond3D is proudly published by GPU Tools Ltd.
Loading...