EECS 366/466 Computer Graphics Project

Spring 2004

Physical Based Modeling for Simulation

by Ozkan Bebek


Introduction:

Physically based modeling is an important approach to computer animation and computer graphics modeling. It can be considered as the combination of physics (control) and computer graphics. As the computation power increase the animations became more and more realistic. As a part of the realization of the real world to the screen, physical based modeling has an important role. It helps us to visualize the objects when they are interacting with the environment or any controls are applied. In this project physical based modeling of rigid bodies will be implemented. Using different objects, interaction of the objects will be observed.


Background:
In this project C++ and OpenGL was used as the computer graphics tool. First the dynamical modeling of the objects, interactions between ground and objects was realized. Discrete time dynamical simulation was implemented by solving dynamical equations of the systems in every step time, T=0.1 ms. The outputs of the models were animated to the screen in every 10 steps to make system work closer to real time.

 

Rigid Body Dynamics

Lets define the state vector for a rigid body where x(t) gives the objects position in the world coordinates and R(t) is the rotation matrix that includes the orientation information of the body at time t. P(t) and L(t) are linear and angular momentums. The goal in rigid body dynamic simulations is to find the changes in the states of an object by using dynamical equalities under the effect of external forces applied. Sum of all the forces acting on the particle: gravity, wind, spring forces, etc can defined as function F(t). If the object has mass m, then the change of X over time is given by:

To describe a rigid body in space we need to know its orientation. In addition to the translation of the body in space, x(t), a rotation matrix, R(t) defining the orientation of the body is used. So if an arbitrary point in the body is described with p0, then the position of the point in world coordinates is:

p(t)= R(t)p0+x(t)

When external forces are applied to the rigid body, Fe(t), as well as the torque τe(t), applied can be described as:

Where r(t) is the an arbitrary point on the rigid body that force is applied.

Linear and angular momentums of a rigid body can be defined as:

So, for a rigid body, defined state vector X(t) is shown above. Thus, the state of a rigid body is its position and orientation (describing spatial information), and its linear and angular momentum (describing velocity information). Computation of the state vector for each time step will give the necessary information to find the values of the state variables for the next step time.

 

Simulation:
For every object necessary state variables are defined. Thus every object is physically modeled. At any time auxiliary quantities, variables other than states, could be calculated and used for animation purposes.

v(t)=P(t)/m     I(t)=R(t)IbR(t)T      w(t)=I(t)-1L(t).

The constant quantities are calculated before starting the simulation, i.e. mass, Ib, Ib-1. After the initialization of the variables the simulation loop is as follows:

0. Initialize the variables; calculate necessary variables before main simulation loop.

1. Form the state vector by using the quantities available, Xk+1

2. Copy the variables to current state Xk

3. Form the using the auxiliary quantities.

4. Using an ODE solver, solve for every time step, T, next state Xk+1.

    E.g.: Euler Forward iteration:

5. Derive the auxiliary quantities using Xk+1.

6. Display the objects using the states.

7. Return Step 1.

The describe algorithm executed in an inner loop under the main algorithm. Selected step time for simulation was 0.1ms. Objects are displayed for every 10 simulation cycles. External forces, such as friction, normal forces are calculated for every step. A Collision detection algorithm used and contact points are modeled as a spring-damper systems.

 

Results and Conclusion:

Physical Based Modeling for different objects, Crate, Beach Ball was implemented. Using OpenGL as a tool, simulation results are displayed. Simulation provides satisfying performance close to real time. The bouncing and rolling of the objects are very life-like.

The mass-spring systems for the contacts are tuned for better visualization. After some simulation time Euler integrator becomes very unstable, causing unexplained rolling and jumping of the objects. So using higher order ODE solvers is more appropriate for the simulation.

 

References:

Spong, M., M. Vidyasagar, ”Robot Dynamics and Control”, John Wiley and Sons, 1989.

Franklin, G., J.D. Powell, M. Workman, Digital Control of Dynamical Systems, 3rd ed.,Addison Wesley, 1997.

Murray, R. M., Z. Li, S. Sastry, Robotic Manipulation, CRC Press, 1993.

Luh, Walker, Paul; On-line Computational Scheme for Mechanical Manipulators, Journal of Dynamic Systems, Measurement, and Control; pp 69-76; June 1980.

Web References:

http://www.ioi.dk/Homepages/thomasj/

http://www.pixar.com/

http://nehe.gamedev.net/

 

 

Download the exe file