Robust cloth self collision handling of a mesh with 49,284 triangles using my custom GPU based solver. The solver was implemented using C++/CUDA and supports ultra thin cloth meshes. In this case, a 2.5mm thickness was used. Final rendering done in Blender.
The (signed) volume of a tetrahedron can be calculated as:
\[
V_{tet} = \frac{1}{6} (\mathbf{x}_1 - \mathbf{x}_0) \cdot ((\mathbf{x}_2 - \mathbf{x}_0) \times (\mathbf{x}_3 - \mathbf{x}_0))
\]This formula is derived from the volume of a parallelepiped. Computing the derivative of this volume is essential in many deformable body simulations which are built ontop of tetrahedral finite elements.
I’m going to make use of the dot product and cross product matrix calculus identities as well as cross product matrices in the derivation that follows. The later two of which I covered in my previous post. I leave them here for reference:
Suppose \(\mathbf{x} \in \mathbb{R}^{3 \times 1}\) and \(\mathbf{f}(\mathbf{x}), \mathbf{g}(\mathbf{x}): \mathbb{R}^{3 \times 1} \rightarrow \mathbb{R}^{3 \times 1}\). The goal is to find the matrix of first-order partial derivatives of the cross product of \(\mathbf{f}\) and \(\mathbf{g}\):
\[ \frac{\partial}{\partial \mathbf{x}}(\mathbf{f}(\mathbf{x}) \times \mathbf{g}(\mathbf{x}))\]A matrix of first-order partial derivatives is also called a Jacobian matrix so an equivalent notation can be defined:
\[ \mathbf{J}_{\mathbf{x}}(\mathbf{f}(\mathbf{x}) \times \mathbf{g}(\mathbf{x})) = \frac{\partial}{\partial \mathbf{x}}(\mathbf{f}(\mathbf{x}) \times \mathbf{g}(\mathbf{x}))\]Instead of taking the derivative with respect to the whole \(\mathbf{x}\), its easier to take it with respect to each component of \(\mathbf{x}\) individually, and build the Jacobian from each of these derivatives. For example, we find \(\frac{\partial \mathbf{f} \times \mathbf{g}}{\partial x_0}\), \(\frac{\partial \mathbf{f} \times \mathbf{g}}{\partial x_1}\), and \(\frac{\partial \mathbf{f} \times \mathbf{g}}{\partial x_2}\) which are all column vectors of partial derivatives. Each of these correspond to a column of the Jacobian matrix so they can be assembled into the complete Jacobian like so: