This project was done as part of the course "252-0546-00L Physically-Based Simulation in Computer Graphics" at ETH Zürich during the HS2024 semester. We have implemented XPBD (Extended Position Based Dynamics) using advanced simulation methods and built it on a modern MVC (Model-View-Controller) architecture, created from the ground up.
Our implementation of XPBD is inspired by the following sources:
- The original "Extended Position Based Dynamics"
- "XPBD: Position-Based Simulation of Compliant Constrained Dynamics"
The architecture is heavily inspired by:
- The Homework framework provided in the course.
- Engineering Tool 2021 Git Repository (partially derived from the same code base).
For geometric mesh-processing, we used a custom fork libigl, which supports directional shadows that are camera independent.
- The tool is also written in such a way to make it possible to overide the vertex and fragment shaders of both dynamic and static objects.
Our implementation of XPBD supports the following constraints:
-
Distance Constraint
Enforces a constant distance between two vertices, allowing for robust spring-like behavior. -
Tetrahedral Volume Constraint
Preserves the volume of tetrahedral meshes, ensuring realistic deformation of 3D objects. -
Shell Volume Constraint
Preserves the volume of non-tetrahedral meshes, using only the face vertices. -
Kinematic Friction
Simulates the energy dissipation when two objects slide against each other. -
Static Friction
Prevents motion between objects at rest relative to each other, up to a threshold. -
Static Collisions
Resolves collisions between objects by preventing interpenetration and maintaining separation.
This project is built using CMake. To build the project:
-
Clone the repository:
git clone git@github.com:ucinereo/PBS-soft-body.git
-
Pull assets using Git LFS:
git lfs pull
-
Create a build directory and configure the project:
mkdir build cd build cmake -DCMAKE_BUILD_TYPE=Release ..
-
Build the project:
cmake --build .
In the viewer there is a dropdown menu where the user can choose between three scenes: Palm Trees and Cuboids without and with BVH acceleration. The Palm Trees scene was shown during the live demo and the Cuboid scenes can be used to see the performance gains when using BVH acceleration. Note that the Cuboid scene without BVH might be running either extremely slow or not at all, that's because the cuboids were heavily subdivided, resulting in 150k static triangles. Thus, this scene serves as a stress test for our implementation.
The user can also play around with several simulation parameters, such as constraint compliance values, volume constraint pressure and friction coefficients.
- Thanks to Matthias Müller for the awesome YouTube videos, which helped alot implementing XPBD.
- Thanks to our course instructors and TAs for the nice lecture slides and explanations.
Our software is available as open source under the terms of the GPL-3.0 license.