Thursday, February 3, 2011

Bringing it Back to Basics

Heyho,

Taking Joe's advice I brought the project back a little. I did start in with some CUDA code, taking the always favorite SimpleGl code sample and adding variables and preparing kernels. Nothing really complicated, mostly setup.

However most of the week's progress went to the CPU. I built up a new framework of particles and springs for a cloth simulation in C++. The framework is simple, but it has a nice little camera that lets me pan around a bit. There are three different types of springs: Structural, Shear and Bend. Those apply forces to the particles and the particles have different integration schemes to move them based on those forces. The particles also respond to gravity and hit a floor at z = 0. It also has callbacks all setup for mouse and keyboard. It mostly came from code from my 277 projects.

Then I implemented 3 different integrators: Verlet, Euler and Midpoint. Currently Verlet and Midpoint are stable, while Euler blows up with the current spring and damping constants. Playing around with those can be fun, because it certainly makes the cloth do interesting things. Currently I've found a balance in the constants that makes the cloth kind of obey the constraints and does not make the cloth explode. Some screenshots below:





So as you can see in the second image, there are some bending along the cloth, which in certainly interesting. Bend springs should be preventing that, but playing with the constants can cause explosions.

The next steps is more integrators, working my way to an implicit euler or implicit RK4. I can already see that Midpoint is starting to change the frame rate a bit, so a smaller lattice might be indicated already. It also might be how I have implemented it, but we'll see. If I have time, I'll also start on the rotational springs in C++ and see if I can integrate them and maybe get some first folding action.

3 comments:

  1. Another good paper to look at is
    http://graphics.stanford.edu/%7Efedkiw/papers/stanford2002-01.pdf
    the Bridson work for collisions.

    and of course the first significant paper using implicit methods for cloth http://www.cs.cmu.edu/%7Ebaraff/papers/sig98.pdf being the baraff + witkin work to see how they set up their integrations

    The main 2 that are missing here are of course RK4, implicit and maybe an IMEX where you use the trapizodal rule and use a half explicit and half implicit step ... it an intresting idea since one is over stable and one is under stable
    Those two sources are here:
    https://www.seas.upenn.edu/~cis563/protected/%28Eberhardt%29-2000-ImplicitExplicit.pdf
    and
    https://www.seas.upenn.edu/~cis563/protected/%28Wetton%29%20-%20IMEX.pdf

    This has a little more on the Baraff and witkin bend springs as well http://www.dgp.toronto.edu/~boivin/pubs/inria-rr5099.pdf

    Also some physically based properties of paper:
    http://www.fibtex.lodz.pl/58_22_91.pdf

    ReplyDelete
  2. High five for reusing 277 code ;-) Looking back, we really did a TON of stuff in that class that's reusable for later work.

    Cool looking screenshots!

    ReplyDelete