Physics MLS-MPM Continuum Mechanics Simulation WebGL

MLS-MPM (Material Point Method) in WebGL2: Snow, Jelly & Elastic-Plastic Fracture


MLS-MPM (1,200 particles · 48×28 quadratic B-spline grid) · Drag anywhere to stir & fling particles
Live Moving Least Squares Material Point Method (MLS-MPM) continuum solver: switch between elastic jelly, plastic-fracturing snow (SVD clamping), and fluid splash in the exact same grid-particle loop.

Both Stable Fluids and D2Q9 Lattice Boltzmann live on purely Eulerian grids – great for smoke and water, terrible for fracturing snowballs or bouncing jelly that carry permanent material history. The Moving Least Squares Material Point Method (MLS-MPM) (Hu et al., SIGGRAPH 2018) gives you the best of both worlds: Lagrangian particles carry mass, velocity, and deformation gradient $\mathbf{F}_p$, while a temporary background Eulerian grid handles collisions and internal forces automatically – zero mesh tangling!


1. Particle-to-Grid (P2G) & SVD Snow Plasticity

Using quadratic B-spline weights $w_{ip}$ over a $3\times 3$ stencil, MLS-MPM fuses the APIC affine velocity matrix $\mathbf{C}_p$ and the first Piola–Kirchhoff elastic stress $\mathbf{P}(\mathbf{F}_p)$ into a single fused scatter pass:

MLS-MPM Fused P2G Momentum Transfer & Snow SVD Yield Surface (Hu et al., 2018)
$$(m\mathbf{v})_i^{n+1} = \sum_p w_{ip}\!\left[ m_p\mathbf{v}_p^n + \left(m_p \mathbf{C}_p^n - \frac{4\Delta t}{\Delta x^2} V_p^0 \frac{\partial \Psi}{\partial \mathbf{F}}\mathbf{F}_p^\top\right)(\mathbf{x}_i - \mathbf{x}_p) \right]$$ $$\mathbf{F}_p = \mathbf{U}\,\boldsymbol{\Sigma}\,\mathbf{V}^\top, \qquad \boldsymbol{\Sigma}_{kk} \leftarrow \mathrm{clamp}\!\big(\boldsymbol{\Sigma}_{kk},\, 1 - \theta_c,\, 1 + \theta_s\big)$$

That three-line SVD clamp is the secret behind Disney's Frozen snow: compress snow beyond $1 - \theta_c$ and it compacts permanently (hardening via $e^{\xi(1 - J_p)}$); stretch it past $1 + \theta_s$ and the elastic stress saturates so chunks cleanly fracture apart!

💻 GLSL: Fused MLS-MPM P2G Elastic Stress & Snow SVD Yield ClampGLSL / MLS-MPM
// MLS-MPM Core Loop (Hu et al., SIGGRAPH 2018): Fused P2G Momentum + Elastic Stress
// For each particle p with deformation gradient F_p and APIC affine matrix C_p:
mat2 U, S, V;
svd2x2(F_p, U, S, V);
// Plasticity clamp for Snow: singular values clamped to [1 - theta_c, 1 + theta_s]
S[0][0] = clamp(S[0][0], 1.0 - theta_c, 1.0 + theta_s);
S[1][1] = clamp(S[1][1], 1.0 - theta_c, 1.0 + theta_s);
F_p = U * S * transpose(V);
float J = S[0][0] * S[1][1];
// Fixed Corotated stress -> fused MLS-MPM affine transfer matrix
mat2 stress = 2.0 * mu * (F_p - U * transpose(V)) * transpose(F_p) + lambda * J * (J - 1.0) * mat2(1.0);
mat2 affine = (-dt * 4.0 * vol0 / (dx * dx)) * stress + mass * C_p;