Material Point Method (snow)
Particle/grid hybrid that simulates snow, sand and other elastoplastic continua, with a yield-based plasticity model that gives fracture, packing and clumping.
Also known as MPM
In the family Simulation & animation, hybrid particle-grid solids
Where it runs
Built inOfficial add-onPluginNone foundNot researched
| Engine | Support | How |
|---|---|---|
| three.js r187 | Official add-on | examples/webgpu_compute_particles_fluid.html docs MLS-MPM fluid compute example, not a snow constitutive model. |
| Babylon.js 9.38.0 | None found | |
| Godot 4.7 | None found | |
| Unity | None found | |
| Unreal 5.7 | None found | |
| Blender 5.2 | None found | |
| WebGPU W3C | None found | |
| Metal | None found |
How it works
Particles carry mass, velocity, a deformation gradient and plastic state. Each step: scatter mass and momentum from particles to a background grid (quadratic B-spline weights), compute grid forces from the elastic energy gradient, update velocities and apply collision boundaries, then gather velocities back and update each particle's deformation gradient. Snow plasticity clamps the singular values of the elastic part of the deformation gradient to a critical compression/stretch range and stores the excess as plastic deformation, with hardening that depends on the compressed volume. Because the grid handles contact and self-collision implicitly, snow can pile, break and fall without explicit collision handling.
When to choose it
Reach for it when
- snow should pack, clump and fracture
- simulating sand or mud that interacts with itself
- granular material needs plasticity and memory
- foam or snow piling against colliders
- deformable solids that remember how they were squashed
Choose it when you need snow, sand, mud, foam or other history-dependent solids that interact with themselves and with rigid colliders. Prefer FLIP/PIC fluids for pure liquids, Real-time snow and terrain deformation for cheap heightfield footprints in games, and Position Based Dynamics or Unified particle physics for realtime solids.
Field marks
- Numerical fracture: separating chunks 'melt' back together across grid-cell gaps
- Explicit time step limits can be tight for stiff materials
- Cell crossing noise with linear shape functions (hence quadratic B-splines)
- Particles can numerically stick to colliders and each other
Presets
Material Point Method (snow) — elasto-plastic snowball fracture & P2G/G2P Eulerian grid transfer
{
"P_PLASTICITY": 0.78,
"P_IMPACT_SPEED": 1,
"P_GRID_VIS": 0.85,
"P_CLUMP_COHESION": 0.72
}Show GLSL (145 lines)
const float P_PLASTICITY = 0.78; // P Plastic Fracture [0.1, 1.5, 0.04]
const float P_IMPACT_SPEED = 1.0; // P Impact Cycle [0.0, 2.5, 0.05]
const float P_GRID_VIS = 0.85; // P Eulerian Grid [0.0, 1.5, 0.05]
const float P_CLUMP_COHESION = 0.72; // P Snow Cohesion [0.2, 1.4, 0.04]
vec2 hash21(float p) {
vec3 p3 = fract(vec3(p) * vec3(0.1031, 0.1030, 0.0973));
p3 += dot(p3, p3.yzx + 33.33);
return fract((p3.xx + p3.yz) * p3.zy);
}
// Evaluate MPM snow clump particle state at cycle phase tau in [0, 1]
// Models pre-impact rigid flight -> plastic compression at wedge -> fractured snow chunks & powder spray
void mpmParticle(int idx, float tau, float plast, float coh, out vec2 pos, out float strain, out float rad) {
float fi = float(idx);
vec2 h = hash21(fi * 19.3 + 5.7);
// 4 cohesive sub-chunks formed upon SVD singular-value clamping fracture
float chunkId = floor(fi / 8.0);
float chunkAng = chunkId * 1.5708 + 0.45;
vec2 chunkOff = vec2(cos(chunkAng), sin(chunkAng)) * 0.075;
// Initial packed snowball disc coordinates
float r0 = sqrt(h.x) * 0.145;
float a0 = h.y * 6.2831853;
vec2 local0 = mix(vec2(cos(a0), sin(a0)) * r0, chunkOff + vec2(cos(a0), sin(a0)) * r0 * 0.45, clamp(coh * 0.55, 0.0, 0.8));
// Flight from upper-left (-0.52, 0.24) into angled basalt wedge at (0.04, -0.14)
float tImpact = 0.34;
if (tau < tImpact) {
float u = tau / tImpact;
vec2 center = mix(vec2(-0.52, 0.24), vec2(-0.04, -0.02), u);
pos = center + local0;
strain = 0.0;
} else {
float u = (tau - tImpact) / (1.0 - tImpact);
// Split upward/downward along the wedge faces + plastic pancake compression
float side = (local0.y + 0.02 > 0.0) ? 1.0 : -1.0;
vec2 splitDir = normalize(vec2(0.72, side * (0.68 + 0.28 * fract(chunkId * 0.618))));
// Plastic compression hardening near impact face, tensile fracture outward
vec2 squashed = vec2(local0.x * (1.0 - 0.52 * min(u * 2.5, 1.0) * plast), local0.y * (1.0 + 0.48 * min(u * 2.2, 1.0) * plast));
float scatter = (0.14 + 0.42 * plast) * u * (0.55 + 0.65 * (1.0 - coh * 0.45) * h.x);
vec2 gravityDrop = vec2(0.0, -0.26 * u * u);
pos = vec2(-0.04, -0.02) + squashed + splitDir * scatter + gravityDrop;
// Keep particles above floor y = -0.34
pos.y = max(pos.y, -0.32 + 0.03 * h.y);
strain = clamp(u * 1.45 * plast * (0.5 + 0.6 * abs(local0.x) * 6.0), 0.0, 1.0);
}
rad = 0.034 + 0.016 * h.y;
}
float sdTriangle(vec2 p, vec2 a, vec2 b, vec2 c) {
vec2 e0 = b - a, e1 = c - b, e2 = a - c;
vec2 v0 = p - a, v1 = p - b, v2 = p - c;
vec2 pq0 = v0 - e0 * clamp(dot(v0, e0) / dot(e0, e0), 0.0, 1.0);
vec2 pq1 = v1 - e1 * clamp(dot(v1, e1) / dot(e1, e1), 0.0, 1.0);
vec2 pq2 = v2 - e2 * clamp(dot(v2, e2) / dot(e2, e2), 0.0, 1.0);
float s = sign(e0.x * e2.y - e0.y * e2.x);
vec2 d = min(min(vec2(dot(pq0, pq0), s * (v0.x * e0.y - v0.y * e0.x)),
vec2(dot(pq1, pq1), s * (v1.x * e1.y - v1.y * e1.x))),
vec2(dot(pq2, pq2), s * (v2.x * e2.y - v2.y * e2.x)));
return -sqrt(d.x) * sign(d.y);
}
vec3 aces(vec3 x) {
x = max(x, 0.0);
return (x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14);
}
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
float px = 1.0 / max(iResolution.y, 1.0);
float tau = fract(iTime * 0.24 * max(P_IMPACT_SPEED, 0.05) + 0.42);
float plast = clamp(P_PLASTICITY, 0.1, 1.6);
float gridVis = clamp(P_GRID_VIS, 0.0, 1.6);
float coh = clamp(P_CLUMP_COHESION, 0.15, 1.5);
// Deep winter alpine twilight studio backdrop
vec3 col = mix(vec3(0.03, 0.048, 0.082), vec3(0.075, 0.115, 0.175), smoothstep(-0.45, 0.55, uv.y));
// Background MPM Eulerian APIC Grid (16x16 cell grid)
float gScale = 14.0;
vec2 gCell = floor(uv * gScale);
vec2 gCenter = (gCell + 0.5) / gScale;
vec2 gf = abs(fract(uv * gScale) - 0.5);
float gLine = smoothstep(0.47, 0.50, max(gf.x, gf.y));
float gNode = smoothstep(0.11, 0.04, length(fract(uv * gScale + 0.5) - 0.5));
// Accumulate Lagrangian snow density, plastic strain, and P2G Eulerian grid activation
float snowDens = 0.0;
float strainSum = 0.0;
float gridAct = 0.0;
float minP = 1e5;
for (int i = 0; i < 32; i++) {
vec2 pp; float st; float rr;
mpmParticle(i, tau, plast, coh, pp, st, rr);
float d = length(uv - pp);
minP = min(minP, d);
float w = exp(-(d * d) / max(rr * rr * 1.15, 1e-5));
snowDens += w;
strainSum += w * st;
// Quadratic B-spline P2G grid weight near current Eulerian cell
float dg = length(gCenter - pp);
gridAct += exp(-dg * dg * 95.0);
}
// Highlight active P2G Eulerian grid cells carrying transferred momentum
if (gridVis > 0.01) {
float act = clamp(gridAct * 0.42, 0.0, 1.0);
col += vec3(0.12, 0.44, 0.72) * act * 0.34 * gridVis;
col += vec3(0.24, 0.46, 0.68) * gLine * (0.14 + 0.45 * act) * gridVis;
col += vec3(0.45, 0.86, 1.0) * gNode * act * 0.55 * gridVis;
}
// Rigid basalt impact wedge & snowy ground plane
float dWedge = sdTriangle(uv, vec2(-0.04, -0.02), vec2(0.32, -0.35), vec2(0.32, 0.22));
float dFloor = -uv.y - 0.35;
if (dWedge < 0.0 || dFloor > 0.0) {
vec3 rock = vec3(0.13, 0.16, 0.22) * (0.85 + 0.25 * smoothstep(-0.35, 0.2, uv.y));
col = mix(col, rock, 0.94);
}
col = mix(col, vec3(0.58, 0.72, 0.88), smoothstep(px * 3.0, px * 0.6, abs(dWedge)) * 0.85);
col = mix(col, vec3(0.48, 0.64, 0.82), smoothstep(px * 2.5, px * 0.5, abs(dFloor)) * 0.75);
// Shaded MPM Snow Clumps (fresh snow white -> icy blue under high plastic hardening strain!)
float snowMask = smoothstep(0.42, 0.72, snowDens);
if (snowMask > 0.005) {
float avgStrain = strainSum / max(snowDens, 1e-4);
float sparkle = fract(sin(dot(floor(fragCoord * 0.75), vec2(12.98, 78.23))) * 43758.5);
vec3 freshSnow = vec3(0.92, 0.95, 0.99);
vec3 compressedIce = vec3(0.32, 0.74, 0.98);
vec3 fracturedTint = vec3(0.98, 0.62, 0.28);
vec3 sCol = mix(freshSnow, compressedIce, clamp(avgStrain * 0.85, 0.0, 1.0));
sCol = mix(sCol, fracturedTint, smoothstep(0.65, 1.0, avgStrain) * 0.45);
// Soft powdery rim lighting + crystalline glint
float rim = smoothstep(1.35, 0.45, snowDens);
sCol *= (0.76 + 0.26 * rim);
sCol += vec3(0.55) * step(0.965, sparkle);
col = mix(col, sCol, snowMask);
}
// Crisp Lagrangian material-point cores
col = mix(col, vec3(1.0, 0.96, 0.85), smoothstep(0.012, 0.004, minP) * 0.55);
fragColor = vec4(pow(clamp(aces(col), 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);
}Attribution: Original interactive WebGL2 fragment shader written for Texel Atlas (MIT).
Measured GPU weight & timing
| Preset | GPU | Weight / p50 / p95 | Method |
|---|---|---|---|
| mpm-snow-live | Tesla T4 1920x1080 | 24.1× baseline (heavy) · 0.757 ms / 0.774 ms | opengl-timer-query · 40 frames · GPU Weight Atlas · Colab T4 sweep |
| mpm-snow-live | NVIDIA L4 1920x1080 | 21.4× baseline (heavy) · 0.339 ms / 0.356 ms · 2.2× faster on L4 | opengl-timer-query · Cross-architecture validation |
| mpm-snow-live | NVIDIA A100-SXM4-40GB 1920x1080 | 15.2× baseline (moderate) · 0.438 ms / 0.452 ms · 1.7× faster on A100 | opengl-timer-query · Cross-architecture validation |
Lineage
From the citation graph (Crossref reference lists): its primary source cites FLIP/PIC fluids.
Sources
- primaryAlexey Stomakhin, Craig Schroeder, Lawrence Chai, Joseph Teran, Andrew Selle (2013). A material point method for snow simulation. ACM Transactions on Graphics.Verified via crossref · 2026-11-29doi:10.1145/2461912.2461948
- implementationtaichi-dev (2020). taichi-dev/taichi_elements. High-performance multi-material continuum physics engine in TaichiGitHub API · license MIT · 2026-11-29