mass ratios

Please don't post Bullet support questions here, use the above forums instead.
defumar
Posts: 4
Joined: Fri Nov 30, 2007 10:13 am

mass ratios

Post by defumar »

I know that with floats as btScalar the mass ratios have to be between 1 and 10 for to be accurate. But what if I'd use doubles, in what range would the mass ratios then have to be?

thanks in advance.
Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Re: mass ratios

Post by Dirk Gregorius »

The mass ratio are limited by the iterative solver, not by the floating point precision.
defumar
Posts: 4
Joined: Fri Nov 30, 2007 10:13 am

Re: mass ratios

Post by defumar »

Thanks for the info, what does the PGS stand for in PGS iterative solver? And is there any way of making it more accurate in exchange of performance and thus where can I find this in the code.
Once more, thanks in advance.
Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Re: mass ratios

Post by Dirk Gregorius »

PGS stands for Projected Gauss Seidel. It is an iterative method to solve Linear Complementary Problems (LCP). PGS is very similar to sequential impulses (SI). The problem with high mass ratios is that they effect the convergence of the iterative scheme. You can find an explanation of this in the book of Kenny Erleben "Physics Based Animation".

You can use other LCP solver, like e.g. Projected Conjugate Gradient (PCG) or Dantzig. The first is also an iterative method, basically the LCP equivalent to Conjugate Gradient which is used to solve systems of linear equations. Dantzig is a direct pivoting method.

You can find example code for the PCG and Dantzig in the ODE source code. I could imagine that you need to look in quickstep.cpp and worldstep.cpp. An example of SI can be found in Bullet.

Note that even though PCG has usually better convergence than PGS it suffers from problems with over-determined systems (e.g. redundant contact information). The same holds true for Dantzig, so in this case both methods don't find any solution at all. You need to guarentee that your system *is* solvable. The PGS solver is *much* more forgiving in these situations - which are very typical by the way.

In the particular case of PGS you have usually linear convergence. You can try Tchebbychev or Aitkins to improve the convergence to super-linear or quadratic convergence. This should help with the mass ratios. I can't provide any informations on this since I haven't found time to investigate in this direction so please let us know if you are successfull with this approach :-)


Cheers,
-Dirk
defumar
Posts: 4
Joined: Fri Nov 30, 2007 10:13 am

Re: mass ratios

Post by defumar »

I am interested in physics engines and would like to get a good understanding of them. Will reading "physics based animation" suffice or should I consider buying one of the following two or is there some other book you'd also like to recommend me.

http://www.amazon.co.uk/Physics-Develop ... 28-5855650
or
http://www.amazon.co.uk/Physics-Morgan- ... 28-5855650
Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Re: mass ratios

Post by Dirk Gregorius »

"Game Physics Engine Development" by Ian Millington is the worst book I can imagine.
"Game Physics" by Dave Eberly is a good book, but it doesn't teach you how to write a physic engine

I recommend looking at Erin Catto's slides from GDC 2006 and 2007. This is how most physic engines (incl. Ageia and Havok) work to my knowledge. So a good start is to port the Box2D_lite to 3D. When you write a physic engine you also need to deal with collisions. I recommend starting with spheres, so you get the overall idea and creating contact information is not difficult. Once you have spheres working you need to decide how you create contact geometry for other shapes. Basically you have two options - GJK and SAT. Before that I would implement a ball-socket joint as first goal. For learning looking at Bullet and ODE (quickstep.cpp and joint.cpp) will also help.

The PhD of Kenny Erleben has a bunch of information and describes the internal functionality of the ODE. You also might want to look at Erin Catto's GDC 2005 presentation.

ftp://ftp.diku.dk/diku/image/publicatio ... 050401.pdf
http://www.gphysics.com

Erwin collected some other useful links here:

http://www.bulletphysics.com/Bullet/php ... p?f=6&t=63

Note that the book "Physic based Animation" mentioned there is basically the PhD of Kenny, so as long as you are only interested in rigid body dynamics you can save the money...
defumar
Posts: 4
Joined: Fri Nov 30, 2007 10:13 am

Re: mass ratios

Post by defumar »

Thank you very much for the info, you've been most helpful! I've decided to buy myself "Game Physics" and will have a look at those slides, hmm physics, physics!!! Delicious.

Greetings,
Def