Home | Computer Graphics |     Share This Page
3D Particle Box

A three-dimensional particle physics playground

P. Lutus Message Page

Copyright © 2021, P. Lutus

Most recent update:

The Application | Documentation

(double-click any word to see its definition)

The Application

Documentation and description appear below the app.


Particle count:
Particle radius pixels:
Maximum velocity m/s:
Energy Restitution:
G acceleration m/s2:
Frame Rate FPS:
Compute Cycles:
Anaglyphic (3D):
Black on White:

Total Energy:


Virtual 10 x 10 x 10 meter cube


This is an experimental computer graphics application that allows you to explore the behavior of particles in a container. The container's properties may be adjusted — its walls may be perfectly elastic, losing no energy, or they may lose a specified amount of energy on each bounce, using the "Energy Restitution" entry.

The "Particle Count" entry selects the number of simulated particles. More than about 50 makes it difficult to figure out what's going on. Larger numbers won't hurt your computer (but maybe your eyes).

The "Particle Radius" entry chooses the particle size, from tiny to beach-ball size.

The "Maximum Velocity" entry chooses the highest velocity randomly assigned to each particle. When the simulator is restarted, a given particle's velocity is randomly generated to lie between +n and -n using this entry's value, in each of the X, Y and Z dimensions.

As explained above, the "Energy Restitution" entry adjusts the elasticity of the container's walls. An entry of 1 makes the container perfectly elastic, meaning no particle energy is lost during a bounce. An entry of 0 causes the particle's energy to be entirely lost in the dimension perpendicular to the wall's orientation. Remember that there are three dimensions and three particle energies — X (left/right), Y (up/down) and Z (toward/away). Each of these dimensions has an independent energy.

More detail at this link: Wikipedia: Coefficient of Restitution

The "G Acceleration" entry can be adjusted to have Earth surface acceleration (9.8 m/s2) or any other value including zero. The zero-G case simulates being in orbit or far away in space with no gravitational forces.

The "Frame Rate FPS" entry adjusts the display frame rate. This control's effectiveness relies on the computer's speed, but with a fast machine, frame rates above 120 FPS are possible.

The "Compute Cycles" entry is a bit more difficult to describe. The simulator numerically solves a differential equation by iteratively processing the usual suspects (position, velocity and acceleration) for a slice of simulator time called "delta-t". The simulator's accuracy improves with smaller delta-t values, so to improve the model's accuracy while keeping the display synchronized with wall time, the simulator repeats the differential solution "Compute cycles" times between outcomes that are displayed.

To maintain realism, the differential solver's time slice (delta-t) is equal to 1/(framerate * computecycles), and the smaller the delta-t value, the more accurate the result. So the most accurate simulation is produced by choosing a high frame rate as well as a high compute-cycles entry.

To test the simulator's accuracy, enter a restitution value of 1, normal Earth gravity (i.e. 9.8 m/s2), and make relatively large frame rate and compute cycle entries. The simulation's accuracy is indicated by a consistent total energy with little variation over time.

Now for the best part of this application IMHO — the "Anaglyphic" checkbox. Click this box and grab some anaglyphic (red/cyan) glasses to see the particle box in 3D. Once you see this application in 3D, you won't want to return to boring, flat computer-display reality.

You can also click the particle box display directly to switch between 2D and 3D displays.

The "Total Energy" display shows the current sum of particle energy for all particles. If you choose an "Energy Restitution" value of 1, this number should not change significantly, because a perfectly elastic bounce loses no energy.

The "Restart" button re-assigns velocities to all the configured particles and restarts the simulation, but without changing any settings.

The "Reset to Default Values" button resets the simulator to its initial default settings — it reverts any entries you may have made and restarts the simulator with its default values.

I hope you enjoy this application!

Home | Computer Graphics |     Share This Page