Cloth Simulation with Finite Element Method
This project along is part of our final project for CS184-Computer Graphics at Berkeley. We implemented a physical based simulator for cloth using finite element methods; we have also serialized the output of our cloth simulator into a global illumination renderer we created.

Demo of simulated cloth

For the Mass-Spring Cloth Simulation, we use the following equations to calculate the force vector between two connected masses:

$$ f_{1} = - \left[ k_{s} ( \left| p_{1}-p_{2} \right| - l_{0} ) + k_{d}\frac{ (v_{1}-v_{2}) \cdot (p_{1}-p_{2}) } {\left|p_{1}-p_{2}\right|} \right] \\ f_{2} = - f_{1} $$

Due to the limit of mass-spring systems, there are some obvious artifacts in the simulation - like lack of stretching force and excess of bending force. However, finite element method nicely solved the above problems from a energy condition approaches.

Below are the equations we used for FEM cloth simulation:

Mesh Deformation Condition:

$$ \textbf{C}(\textbf{x}) = a \left( \begin{matrix} \|\textbf{w}_{u}(\textbf{x})\| - b_{u} \\ \|\textbf{w}_{v}(\textbf{x})\| - b_{v} \\ \end{matrix} \right) $$

Stretching Force:

$$ \textbf{f}_{i} = - \frac{\partial \textit{E}_{C}}{\partial \textbf{x}_i} = - k \frac{\partial \textbf{C}(\textbf{x})}{\partial \textbf{x}_i}\textbf{C}(\textbf{x}) $$

Stretching Damping Force:

$$ \textbf{d} = -k_{d} \frac{\partial \textbf{C}(\textbf{x})}{\partial \textbf{x}} \dot{\textbf{C}}(\textbf{x}) $$

Sheering Force:

$$ \textit{C}(\textbf{x}) = a\textbf{w}_{u}(\textbf{x})^{\textit{T}}\textbf{w}_{v}(\textbf{x}) $$

Bending Force Directions:

$$ u_{1} = \left|E\right| \frac{N_{1}}{\left|N_{1}\right|^2} \\ u_{2} = \left|E\right| \frac{N_{2}}{\left|N_{2}\right|^2} \\ u_{3} = \frac{(x_{1} - x_{4}) \cdot E}{\left|E\right|} \frac{N_{1}}{\left|N_{1}\right|^2} + \frac{(x_{2} - x_{4}) \cdot E}{\left|E\right|} \frac{N_{2}}{\left|N_{2}\right|^2} \\ u_{4} = - \frac{(x_{1} - x_{3}) \cdot E}{\left|E\right|} \frac{N_{1}}{\left|N_{1}\right|^2} - \frac{(x_{2} - x_{3}) \cdot E}{\left|E\right|} \frac{N_{2}}{\left|N_{2}\right|^2} \\ $$

Bending Force Magnitude:

$$ \textit{F}_{i}^{e} = k^{e} \frac{\left|E\right|^{2}} {\left|N_{1}\right| + \left|N_{2}\right|} \sin(\unicode[Times]{x3B8} / 2) u_{i} $$

Bending Damping Force:

$$ \textit{F}_{i}^{d} = -k^{d} \left|E\right| (d\unicode[Times]{x3B8} / dt) u_{i} $$

We use verlet integration since it works nice with moderate time step, and the calculation in each time step is in acceptable range.

FEM cloth simulation is implemented with OpenMP to accelerate the calculation speed in each timestep.

Also, our simulator could output each frame as an image file or an .obj file, and the obj data file could be serialized into our global illumination renderer.

Here are two videos showing rendered cloth simulation videos.

Breeze

Gravity

Acknowledgments: During the development of this project, we are instructed by Professor James O’Brien and our GSI Jiamin Bai and Brandon Wang. We have also gained instructions from Professor Nancy Pollard’s course assignment, Professor David Baraff’s Large steps in cloth simulation, and Professor Robert Bridson’s Simulation of Clothing with Folds and Wrinkles.