View Full Version : 3D objects in gravitation field.

04-11-2001, 10:43 PM
does anybody know how to make quite complicated simulations of say falling stone made of polygons into sharp-edged ground involving things like
- gravitation
- mesh and air resistance
and of course collisions with any other objects......

i'd be very pleased if someone writes me where can i find such infos..........

Michael Steinberg
04-11-2001, 11:08 PM
as of gravitation

F = gamma * (m1 * m2) / r^2

where gamma is about 6,67259*10^-11 m^3/(kg*s^2)

Since F=m*a -> a = f/m it's easy to calculate the acceleration. You must however be able to look at the gravitation objects as if they would be infinite small points.

As of air resistance
First off, if they would know really good how to calculate the air resistance, they wouldn't be still using models to simulate it. So it might me best to give the resistance constant for an object to an easy formula.
Fw = 0.5 * cw * rho * v^2 * A

- cw is the constant for the object and for the object to move in only one direction
- rho is the density of the gas, 1,29 kg/m^3
air for example
- v is the speed of the gas relative to the object (being orthogonal to it)
- A is the "querschnitt" of the object in its particular direction in your case.

04-11-2001, 11:18 PM

i have already had some approaches to different simulation but most problematic is that the objects have to be dynamic (i mean they should iteract with other objects)..... they should move and spin with changing values...
and what you wrote about being infinite small is quite a big problem...... i realised it when i wrote small simulation of some balls falling / jumping onto the static ground.....
as i cant consider infinite small intervals of time i'm not able to compute an exact position of the ball in the next time-unit....and sometimes because of that problem balls where going ones onto each other causing not wanted effects......

Michael Steinberg
04-11-2001, 11:23 PM
You can make the timestep as small as you want. I only spoke about the extents of the object. I believe with a simulation like 0.01 seconds for a time step you should get reasonable results. You should try to get collision detection a bit time independent, when I follow your problem correctly.

04-11-2001, 11:38 PM
....and this is the problem : "time independent"...

nevermind.... do you have any good idea how to compute the movement vector of an object (as a mesh of triangles) after collision... say you are given : present movement vector [x, y, z] and information about spinnig at the moment (spinning can be represented as for example 4 values: vector around which the object is spinnig and spinning speed).... and we can assume the heavy-midpoint is somewhere in the middle of an object.....
we have whole 3D model of the ground and mentioned object that in the next time unit will colllide with ......

Michael Steinberg
04-11-2001, 11:45 PM
Uh oh... That really sounds complicated... Maybe you can try to say that the collision point is static and not that the two objects affect each others?
Gonna think about that one...

04-11-2001, 11:54 PM
ok.... http://www.opengl.org/discussion_boards/ubb/smile.gif
let the object be an ideal sphere (i think it'is the simplest-but not simple model)... and the ground is of course static....

remark: it's getting much harder when you put 2 balls into your world... when they're very close and there are many blocking walls around then it's not easy (for me) to compute everything as it shoul be...

Michael Steinberg
04-11-2001, 11:58 PM
Then it degrades to some kind of 2 dimensional problem.

04-12-2001, 12:02 AM
2D problem? i think it's not quite that easy....

Michael Steinberg
04-12-2001, 12:05 AM
Well after thinking about it that is not correct...
It is a 2d problem when you make a cut of the world through the centers of the spheres.

Michael Steinberg
04-12-2001, 12:09 AM
Well, you've got the vector that connects the two mass centers. A same vector with a different length must be added to the movement vectors of the spheres.

Michael Steinberg
04-12-2001, 12:15 AM
Forget it... I think I'm too stupid doing that... Can't provide any links. Sorry!

04-12-2001, 12:18 AM
you were right .....
anyway it's rather easy to find the movement vector after collision ball-ball or ball-mesh .....
i find it more difficult to "make" spinning...

but last question....
do you know how should the ball spin after falling onto the infiniteXYZ wall with given normal vector?
or rather how should change the spinning vector or it's representation....

Michael Steinberg
04-12-2001, 12:24 AM
I'm currently not sure, but if it's not bouncing off (perfectly hard), it will move along the plane afterwards with the movement vector along the tangential component of the initial movement vector. If you understand what I mean. Then let it simply rotate as if it would roll over the plane. But I don't know if the resulting rotation would speed up the sphere again... http://www.opengl.org/discussion_boards/ubb/smile.gif

Michael Steinberg
04-12-2001, 12:26 AM
But you could calculate the energy that gets absorbed during the colision (the vertical component) and let this energy rotate the sphere. Well, a bit theoretical speaken.

Michael Steinberg
04-12-2001, 12:30 AM
And if the sphere bounces you can simply calculate the reflection vector and make it short with some amount, since you lost energy due to deformation.

04-12-2001, 12:36 AM

anyway... is there anywhere in internet any site relating things i asked you about.... if you know or if you know whom would i ask i'd be very pleased......
i've already tried to find something related but nowhere, nobody, nothing......

Michael Steinberg
04-12-2001, 12:38 AM
There's a rigid body demo over at nvidia.com

Michael Steinberg
04-12-2001, 12:40 AM
I think I'll delete all my old postings... http://www.opengl.org/discussion_boards/ubb/smile.gif

04-12-2001, 02:44 AM
RIGID BODY DYNAMICS http://www.opengl.org/discussion_boards/ubb/cool.gif
This is really getting into some physics.
First, the motion of the sphere in a gravitational field with or without air resistance is known as a "rigid body problem". You've got some nice postings re: F=ma (or Gm1m2r^-2). Moreover, real life gets dicey when you want to deal with air resistance: Laminar or Turbulent flow? Windy or calm? etc. Anyway, the simple things are solved easily with the schema above by integrating time steps. It sounds like you're using an Euler methods with tiny time steps. This is OK for well behaved differential equations which is what you have at the moment. {You need better methods (e.g. 4 step Runge Kutta) for more complex systems of bodies.} If it gets really nasty, you need quite a robust integrator.

COMPUTATIONAL FLUID DYNAMICS http://www.opengl.org/discussion_boards/ubb/wink.gif
Nasty flow problems, such as air flow around an object is typically solved by CFD experts using the finite element method. You're OK with the simple approximation presented above and can avoid CFD for very simple approximations.

DEFORMATION OF A SPHERE http://www.opengl.org/discussion_boards/ubb/eek.gif
There may be simple models out there. I doubt it. In reality you're trying to solve a Continuum Mechanics problem. The sphere should be solid or the shell should have finite thickness. In real life anyway (if that's were we are) all hollow shell objects have thickness, all solid objects have material "inside".

THE BAD NEWS http://www.opengl.org/discussion_boards/ubb/frown.gif
You need to solve the system differential equations of deformation to solve this.(A system of the form: Mx'' +Dx' +Kx= Fexternal where x is distance traversed by a node). This means that stress and strain tensors, mass, dampening, and stiffness coefficients should not be foreign to you. This problem is typically solved using the finite element method. This is the stuff of PhD theses. This is why studios like Pixar hire people like Michael Kass. This area of computer graphics and vision is known as DEFORMABLE MODELING. Much of the physics was solved in the last 150 years. The trouble is doing the math for totally REAL problems is generally impossible analytically. That's where the finite element method comes in as a numerical approximation.

If you build a sphere as a system of springs between the nodes on the surface and some inside to keep it from caving in on itself, you'll get an approximate solution without dealing with tensors. You'll still need Dx'+Kx=Fexternal. The dampening D (shock absorber) adds numerical stability and K is the stiffness of the spring from F=-kx. M is the mass matrix and you can avoid it for certain cases, otherwise you'll need to deal with moments of inertia. The Euler method (even with tiny time steps) may blow up on you- then go to Runge Kutta. The trick is in placing the springs. I warn you that the numerical complexity/instability goes WAY UP for more than a few springs.
Take a look at http://www.cs.toronto.edu/~dt/ who started all of this for graphics and vision in the late 1980's.
Then do a search on DEFORMABLE MODELING with your favorite web engine. You might also try a search on Michael Kass. http://www.opengl.org/discussion_boards/ubb/smile.gif

[This message has been edited by iss (edited 04-12-2001).]

04-12-2001, 03:09 AM
thanks a lot.........