A simple jelly simulation using Position Based Dynamics.
This project references to the famous Position based dynamics (PBD). However, traditional PBD has several problems
- The stiffness is depend on time step.
- Setting relative stiffness is difficult.
To address these problem, XPBD is introduced by Miles Macklin and his fellows. Unlike original PBD, XPBD allows users to accurately and efficiently simulate arbitrary elastic and dissipative energy potentials in an implicit manner.
Click on JellySimulation.sln
and build it in Visual Studio (2019 is prefered).
- OpenGL 3.2+
- Assimp 4.1
- GLM
- GLFW
In PBD, each constraints updates its position with
where denotes the iteration index, is the constraint index, and . And is the scalaring factor that
Original PBD algorithm
- Predict position with velocity
$v$ and external forces - Initialize
- while
- Update positions
- Update velocities
In contrast, XPBD uses Lagrangian rather than throw away that value. It is accumulated in a per-constraint variable .
XPBD algorithm
- Predict position with velocity
$v$ and external forces - Initialize
- Initialize
- While
- Update positions
- Update velocities
Environment
- CPU: Intel® Xeon® Processor E3-1231 v3
- GPU: Nvidia GeForce GTX 1070
- RAM: 16 GB
- OS: Windows 10 pro, 64-bit
PBD
XPBD
- Stiffness settings
- PBD stiffness: 0.025
- The value of PBD stiffness locates between 0 to 1
- XPBD compliance: 0.0005 (m/N)
- Notice: PBD and XPBD stiffness is very hard to compare (not in the same unit) because PBD stiffness is relative stiffness.
- PBD stiffness: 0.025
- M. Müller, B. Heidelberger, M. Hennix, and J. Ratcliff, “Position based dynamics,” Journal of Visual Communication and Image Representation, vol. 18, pp. 109–118, apr 2007.
- M. Macklin, M. Müller, and N. Chentanez, “XPBD,” in Proceedings of the 9th International Conference on Motion in Games - MIG '16, ACM Press, 2016.