real-time physics simulations
The research paper describing, in detail, how the quanta-bond method of simulation works, as well as comparisons with other methods, is available below. For more concise information on implementing the algorithm, see the manual.
|Research paper||v1.0||October 29, 2011||ODT / PDF|
Performing a simulation requires a system definition and an appropriate
timestep size to perform the simulation on. In order to solve
the defined system, a hybrid-implicit integrator is used, allowing for
stiff, highly coupled systems to be solved with a guarantee of
stability. This manual briefly describes, at a high level, the
steps necessary to construct and run a simulation.
No source code which implements the quanta-bond method of simulation will be released, however, the math necessary to construct an implementation independently is documented here.
2. Defining the System
Each system being simulated is constructed in terms of quanta and
Quanta are added to a system to represent a collection of atoms. Quanta maintain values representing their mass, position, velocity, and acting forces. Once the quanta are laid out in space, they can be connected with bonds.
Bonds can behave like springs with one of two options: the reacting force of the bond can grow linearly, or it can fall off inversely as the bond stretches. A bond can connect exactly two quanta to each other, and is defined to have a resting length, a bond force constant, and a dampening coefficient. The resting length is the length at which the bond exhibits no force on either of the connected quanta. The bond force constant is the amount of force applied to the quanta as the bond is stretched. The dampening coefficient is the amount of energy lost as the bond applies force to the connected quanta. More rigid bodies will have higher bond force constants, while softer bodies will be lower.
It is possible to modify a system while it is being simulated. By breaking or forming bonds under various conditions, body deformation can be achieved.
Once construction of a system is complete, it is ready to be simulated.
3. Selecting a Timestep
Progressing the simulation of a system forward in time is done in iterations, called
timesteps. Selecting an appropriate timestep size can be
difficult. If the timestep is too large, the simulation won't be
accurate. If the timestep is too small, it'll take too long to progress
a simulation forward and the simulation won't be real-time. Some
experimentation is usually the best approach to selecting an appropriate
The typical approach is to select a timestep smaller than the desired frame rate, then progress the simulation multiple times per frame. For example, if 30 frames per second are desired, a timestep set at 1/90 of a second could be used. Each frame would then progress the simulation 3 times per frame. This method allows for a small timestep, improving the accuracy of the simulation.
4. Performing the Simulation
This is a quick description of the equations necessary to actually perform the
simulation. The research paper
explains the differential equations used, and how the integrator to solve those
equations functions. In order to guarantee stability of the system, regardless
of stiffness, a hybrid-implicit method of integration was used (as opposed to an explicit
method such as Runge-Kutta).
The figure below represents a simple two quanta, one bond system and defines a set of required variables.
There are two possible equations which define the reacing force a bond places on quanta as it stretches. For bonds that apply a reacting force that grows linearly, the following equation is used:
If the reacting force falls of inversely as the bond stretches, the following equation is used:
The final equation solves the change in velocity for an individual quanta. The change in velocity is computed for each quanta i. Each quanta may have j other quanta bonded to it. The change in velocity needs to be found for each quanta i, by taking into consideration the influence exerted on i by all bonded quanta j. In the equation below, h represents the size of the timestep:
Once the velocity change for each quanta i is known, the quanta's new acceleration is known. With the new information, the new velocity and position of the quanta can also be determined.
Because the quanta-bond method isn't fully-implicit, each quanta's change in velocity can be solved in parallel with other quanta in the same system. This allows for high-performance, high-accuracy simulations of both rigid and soft bodies.