GitXplorerGitXplorer
i

Stable-Neo-hookean-Flesh-Simulation

public
26 stars
2 forks
0 issues

Commits

List of commits on branch main.
Unverified
96682c6c208694e372c53b12cee2718b04d286c3

add note on mouse setting

committed 4 years ago
Unverified
1493661339ca870549c23dfea454ea14e51fe7f6

add submodule for README

committed 4 years ago
Unverified
58402755d0e94406e1b12ae57bbed54b0d6fe43b

chage the libigl to the history commit(works)

iiyht committed 4 years ago
Unverified
28c93820d98f90ec176a990ad5cb0e1d4ca205c9

make a libigl submodul

iiyht committed 4 years ago
Unverified
6950495da14bd19503df105129618162edb2a28c

but fix

iiyht committed 4 years ago
Unverified
1b71b050ad9e1f15659e1eba1022649283b5ba89

add URL

committed 4 years ago

README

The README file for this repository.

Stable Neo-Hookean Flesh Simulation

Stable Neo-Hookean is a hyperelastic energy that remain stable under large deformations. This is the FEM implementation with Stable Neo-Hookean energy in libigl.

Demo video here.

Finite Element Method with Tetrahedron Mesh

  • phi_linear_tetrahedron.cpp

In order to enable the physics simulation, all deformation laws have to be discretized. Tetrahedral meshes are common discrete volumetric geometry representations. All the quantity inside the volume can be represent use a shape function $\phi_i(x)$ where $x \in R^3$ is a position inside the space volume.

The general coordinates are formed as a stack vector $q$

Kinetic Energy

  • T_linear_tetrahedron.cpp
  • mass_matrix_mesh.cpp
  • mass_matrix_lnear_tetrahedron.cpp

For a Tetrahedron, we need to consider the kinetic energy of every infitesmial piece of mass inside the tetrahedron $$ T = \frac{1}{2}\dot{q}^TM\dot{q} $$ where the $M$ is the per-element mass matrix

Deformations

  • dphi_linear_tetrahedron_dX.cpp

To determine forces due to deformation, we need to know how the nearby points have moved relative to one another. This information is captured by the Deformation Gradient $F$.

The Strain Energy

  • psi_neo_hookean.cpp

The hyperrelastic energy density $\psi$ is used to enable the elastic behavior of a deformable body. The paper propose
$$ \psi_{\text{Stable}}(F) = \frac{\mu}{2}(I_C - 3) + \frac{\lambda}{2}(J - 1 - \frac{\mu}{\lambda})^2 $$ where $J=\text{det}(F)$, $I_C = \text{tr}(F^TF)$, $\mu$ and $\lambda$ are Lamé constants.

Stable

I also test the Neo-Hookean energy from Bower 2009 $$ \psi_{\text{Neo}}(F) = \frac{\mu}{2}(J^{-\frac{2}{3}}I_C - 3) + \frac{\lambda}{2}(J - 1)^2 $$

Unstable

Potential energy

  • V_linear_tetrahedron.cpp

$$ V = \int_{\text{volume}}\psi(F) dV $$

Forces and Stiffness

  • dV_linear_tetrahedron_dq.cpp
  • dV_spring_particle_dq.cpp
  • d2V_linear_tetrahedron_dq2.cpp
  • dpsi_neo_hookean_dF.cpp
  • d2psi_neo_hookean_dF2.cpp

Per-element generalized force $$ \text{f} = -\frac{\partial V}{\partial q} $$ Per-element stiffness $$ \text{K} = -\frac{\partial^2 V}{\partial q^2} $$ To assemble the global forces vector and global stiffness matrix:

  • assemble_forces.cpp
  • assemble_stiffness.cpp

Time Integration

  • newtons_method.h
  • implicit_euler.h

I test the Newton-type Implicit Integration scheme and Linea Search with both LDLT(fast) and Conjugate Gradient solvers(slow). LDLT can perform much faster and perform the real-time simulation.

Skinning

  • build_skinning_matrix.cpp

Directly run FEM on the high resolution mesh can be slow. To get the real-time simulation, I use the Skinning to mapping the motion from low resolution armadillo tetrahedron mesh to the high resolution armadillo triangle mesh.

Dependnecy

sudo apt-get install git
sudo apt-get install build-essential
sudo apt-get install cmake
sudo apt-get install libx11-dev
sudo apt-get install mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev
sudo apt-get install libxrandr-dev
sudo apt-get install libxi-dev
sudo apt-get install libxmu-dev
sudo apt-get install libblas-dev
sudo apt install libxinerama-dev libxcursor-dev

How to run?

Mac & Ubuntu

Build:

git submodule update --init --recursive
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make

Then you can start to drag the armadillo with following command:

Run with Stable Neo-Hookean

./stable_neohooken stable

Run without Stable Neo-Hookean

./stable_neohooken nonstable

Note

Notice that different mouse/touchpad setting can effects the mouse force acting on the armadillo. For Ubuntu 20.04, it seems the touchpad can act larger force than mouse on the same machine, so I make the demo using the touchpad.

Acknowledgement

The framework of this project is based on assignment from Prof. David I.W. Levin.