Physics simulation is a core topic in visual computing, with applications in virtual prototyping, training simulators, robotics, visual effects for film, and computer games.
This page collects interactive examples that explain the main methods step by step. Each example runs directly in your browser, so there is nothing to install, and comes with a short explanation of the underlying theory. You can change parameters and watch how the simulation reacts.
The examples were written for my lectures at RWTH Aachen University. They cover:
- Numerical foundations: finite differences, numerical and time integration, linear solvers and Newton's method
- Particles and rigid bodies: particle systems, quaternions and impulse-based collision handling
- Deformable solids: mass-spring systems, the Finite Element Method (FEM), and impulse- and position-based methods (IBDS, PBD, XPBD, shape matching)
- Fluids: Smoothed Particle Hydrodynamics (SPH)
- Collision detection: broad-phase methods, the Lin-Canny and GJK algorithms, and signed distance fields
New to the topic? Start with Numerical Foundations; the later sections build on it.
Teaching a course? You are welcome to use the examples. The source code is available on GitHub under the MIT license.
For a deeper introduction to specific topics, see our tutorials:
- Position-Based Dynamics (PBD)
- Smoothed Particle Hydrodynamics (SPH)
- Multiphysics simulation
- Further tutorials
- Barycentric coordinates
- Finite differences
- Numerical integration
- Quaternion rotation
- Polar decomposition
- Heat equation
- Explicit time integration methods: comparison for a constant force
- Explicit and implicit time integration methods: comparison for a spring model
- Energy conservation of a spring-damper model
- Newton's method
- Newton's method for minimization (1D)
- Newton's method for minimization (2D)
- Newton's method with backtracking line search
- Newton's method: the saddle point problem
- Particle system: a simple particle system
- Rigid body emitter: an emitter that emits rigid bodies with rotation and angular velocity
- Impulse-based collision handling for rigid bodies
- Mass-spring system
- Deformation gradient and strain tensor
- FEM: corotated linear elasticity
- FEM: St. Venant-Kirchhoff model
- FEM: Neo-Hookean model
- Impulse-Based Dynamic Simulation (IBDS)
- Position-Based Dynamics (PBD)
- Extended Position-Based Dynamics (XPBD)
- Shape matching
- Region-based shape matching
- Kernel functions and their derivatives
- SPH approximation of different functions: the benefit of a Shepard filter
- SPH approximation of a user-defined function: the benefit of a Shepard filter
- SPH gradient approximation: a quadratic function and the benefit of a kernel gradient correction
- Neighborhood search
- Weakly Compressible SPH (WCSPH)
- Position-Based Fluids (PBF)
- Implicit Incompressible SPH (IISPH)
- Divergence-Free SPH (DFSPH)
- Bounding volumes
- Sweep and prune for AABB overlap tests
- Bounding volume hierarchy (BVH)
- Spatial hashing
- Signed distance functions: sphere, box
- Signed distance field