Trevor Waldorf

Position Based Dynamics

C++, OpenGL


Code

View on Github.

Notes

A constraint-based soft body visualizer in C++ and OpenGL based on M. Muller et al. 2006.

Floating Point Errors

In C++ you can configure the float library to throw errors when -nan(ind) is triggered, which was very useful for debugging the numerics in this project. See _controlfp_s on MS.com.

Gauss-Seidel

When doing Gauss-Seidel error bounds and iterations by hand on my Numerical Analysis final I was somewhat distraught that I would never use such a skill. Fortunately, that was not the case, as PBD uses a nonlinear Gauss-Seidel stepper when solving for general constraints. Although I currently have only implemented a special case of the solver, it seems very doable to create a general constraint solver following the methods outlined in the paper and some matrices.

OpenGL

I followed the wonderful LearnOpenGL.org series to familiarize myself with OpenGL enough to set up the visualizer. A project on surfaces of revolution from my graphics programming class in undergrad was extremely helpful background for dynamically constructing the mesh information.

I referenced IQ's Clever Normalization of a Mesh for smoother fabric-esque normals and Nobuo Nakagawa's excellent XPBD implemetation which was helpful for sanity checking while debugging and also taught me a lot about particular C++ style.

← Home