{
 "id": "mpm-snow",
 "title": "Material Point Method (snow)",
 "aliases": [
  "MPM"
 ],
 "domain": "simulation",
 "subdomain": "hybrid particle-grid solids",
 "stage": "simulation",
 "realtime": "interactive",
 "platforms": [
  "cpu",
  "cuda",
  "desktop-gpu",
  "python",
  "houdini"
 ],
 "year_introduced": 2013,
 "inputs": [
  "particles",
  "voxels"
 ],
 "outputs": [
  "particles"
 ],
 "style": "photoreal",
 "dynamic": "dynamic",
 "summary": "Particle/grid hybrid that simulates snow, sand and other elastoplastic continua, with a yield-based plasticity model that gives fracture, packing and clumping.",
 "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_use": "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, `snow-terrain-deformation` for cheap heightfield footprints in games, and `position-based-dynamics` or `unified-particle-physics` for realtime solids.",
 "cost": {
  "class": "offline",
  "notes": "Heavy per-particle and per-grid-node work; offline at film quality, interactive on GPU at tens to hundreds of thousands of particles."
 },
 "failure_modes": [
  "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"
 ],
 "sources": [
  {
   "role": "primary",
   "key": "doi:10.1145/2461912.2461948",
   "type": "paper",
   "title": "A material point method for snow simulation",
   "authors": [
    "Alexey Stomakhin",
    "Craig Schroeder",
    "Lawrence Chai",
    "Joseph Teran",
    "Andrew Selle"
   ],
   "year": 2013,
   "venue": "ACM Transactions on Graphics",
   "url": "https://doi.org/10.1145/2461912.2461948",
   "ids": {
    "doi": "10.1145/2461912.2461948"
   },
   "license": null,
   "extra": {
    "csl_type": "journal-article"
   },
   "provenance": {
    "title": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/2461912.2461948",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/2461912.2461948",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/2461912.2461948",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/2461912.2461948",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/2461912.2461948",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 1,
   "__bib": "stomakhin2013material"
  },
  {
   "role": "implementation",
   "key": "gh:taichi-dev/taichi_elements",
   "type": "code",
   "title": "taichi-dev/taichi_elements",
   "description": "High-performance multi-material continuum physics engine in Taichi",
   "authors": [
    "taichi-dev"
   ],
   "year": 2020,
   "venue": "GitHub",
   "url": "https://github.com/taichi-dev/taichi_elements",
   "ids": {
    "repo": "taichi-dev/taichi_elements"
   },
   "license": "MIT",
   "extra": {
    "stars": 570,
    "stars_checked": "2026-11-29",
    "archived": false,
    "fork": false,
    "pushed_at": "2024-04-14T20:43:07Z",
    "language": "Python",
    "homepage": null,
    "license_name": "MIT License"
   },
   "provenance": {
    "title": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/taichi-dev/taichi_elements",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/taichi-dev/taichi_elements",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/taichi-dev/taichi_elements",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/taichi-dev/taichi_elements",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/taichi-dev/taichi_elements",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "license": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/taichi-dev/taichi_elements",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": null,
   "__bib": "taichidev2020taichi"
  }
 ],
 "presets": [
  {
   "id": "mpm-snow-live",
   "title": "Material Point Method (snow) — elasto-plastic snowball fracture & P2G/G2P Eulerian grid transfer",
   "runtime": "glsl-fragment",
   "params": {
    "P_PLASTICITY": 0.78,
    "P_IMPACT_SPEED": 1,
    "P_GRID_VIS": 0.85,
    "P_CLUMP_COHESION": 0.72
   },
   "basis": "original",
   "license_note": "Original interactive WebGL2 fragment shader written for Texel Atlas (MIT).",
   "code": "const float P_PLASTICITY = 0.78; // P Plastic Fracture [0.1, 1.5, 0.04]\nconst float P_IMPACT_SPEED = 1.0; // P Impact Cycle [0.0, 2.5, 0.05]\nconst float P_GRID_VIS = 0.85; // P Eulerian Grid [0.0, 1.5, 0.05]\nconst float P_CLUMP_COHESION = 0.72; // P Snow Cohesion [0.2, 1.4, 0.04]\n\nvec2 hash21(float p) {\n  vec3 p3 = fract(vec3(p) * vec3(0.1031, 0.1030, 0.0973));\n  p3 += dot(p3, p3.yzx + 33.33);\n  return fract((p3.xx + p3.yz) * p3.zy);\n}\n\n// Evaluate MPM snow clump particle state at cycle phase tau in [0, 1]\n// Models pre-impact rigid flight -> plastic compression at wedge -> fractured snow chunks & powder spray\nvoid mpmParticle(int idx, float tau, float plast, float coh, out vec2 pos, out float strain, out float rad) {\n  float fi = float(idx);\n  vec2 h = hash21(fi * 19.3 + 5.7);\n  // 4 cohesive sub-chunks formed upon SVD singular-value clamping fracture\n  float chunkId = floor(fi / 8.0);\n  float chunkAng = chunkId * 1.5708 + 0.45;\n  vec2 chunkOff = vec2(cos(chunkAng), sin(chunkAng)) * 0.075;\n\n  // Initial packed snowball disc coordinates\n  float r0 = sqrt(h.x) * 0.145;\n  float a0 = h.y * 6.2831853;\n  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));\n\n  // Flight from upper-left (-0.52, 0.24) into angled basalt wedge at (0.04, -0.14)\n  float tImpact = 0.34;\n  if (tau < tImpact) {\n    float u = tau / tImpact;\n    vec2 center = mix(vec2(-0.52, 0.24), vec2(-0.04, -0.02), u);\n    pos = center + local0;\n    strain = 0.0;\n  } else {\n    float u = (tau - tImpact) / (1.0 - tImpact);\n    // Split upward/downward along the wedge faces + plastic pancake compression\n    float side = (local0.y + 0.02 > 0.0) ? 1.0 : -1.0;\n    vec2 splitDir = normalize(vec2(0.72, side * (0.68 + 0.28 * fract(chunkId * 0.618))));\n    // Plastic compression hardening near impact face, tensile fracture outward\n    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));\n    float scatter = (0.14 + 0.42 * plast) * u * (0.55 + 0.65 * (1.0 - coh * 0.45) * h.x);\n    vec2 gravityDrop = vec2(0.0, -0.26 * u * u);\n    pos = vec2(-0.04, -0.02) + squashed + splitDir * scatter + gravityDrop;\n    // Keep particles above floor y = -0.34\n    pos.y = max(pos.y, -0.32 + 0.03 * h.y);\n    strain = clamp(u * 1.45 * plast * (0.5 + 0.6 * abs(local0.x) * 6.0), 0.0, 1.0);\n  }\n  rad = 0.034 + 0.016 * h.y;\n}\n\nfloat sdTriangle(vec2 p, vec2 a, vec2 b, vec2 c) {\n  vec2 e0 = b - a, e1 = c - b, e2 = a - c;\n  vec2 v0 = p - a, v1 = p - b, v2 = p - c;\n  vec2 pq0 = v0 - e0 * clamp(dot(v0, e0) / dot(e0, e0), 0.0, 1.0);\n  vec2 pq1 = v1 - e1 * clamp(dot(v1, e1) / dot(e1, e1), 0.0, 1.0);\n  vec2 pq2 = v2 - e2 * clamp(dot(v2, e2) / dot(e2, e2), 0.0, 1.0);\n  float s = sign(e0.x * e2.y - e0.y * e2.x);\n  vec2 d = min(min(vec2(dot(pq0, pq0), s * (v0.x * e0.y - v0.y * e0.x)),\n                   vec2(dot(pq1, pq1), s * (v1.x * e1.y - v1.y * e1.x))),\n                   vec2(dot(pq2, pq2), s * (v2.x * e2.y - v2.y * e2.x)));\n  return -sqrt(d.x) * sign(d.y);\n}\n\nvec3 aces(vec3 x) {\n  x = max(x, 0.0);\n  return (x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14);\n}\n\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) {\n  vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;\n  float px = 1.0 / max(iResolution.y, 1.0);\n  float tau = fract(iTime * 0.24 * max(P_IMPACT_SPEED, 0.05) + 0.42);\n  float plast = clamp(P_PLASTICITY, 0.1, 1.6);\n  float gridVis = clamp(P_GRID_VIS, 0.0, 1.6);\n  float coh = clamp(P_CLUMP_COHESION, 0.15, 1.5);\n\n  // Deep winter alpine twilight studio backdrop\n  vec3 col = mix(vec3(0.03, 0.048, 0.082), vec3(0.075, 0.115, 0.175), smoothstep(-0.45, 0.55, uv.y));\n\n  // Background MPM Eulerian APIC Grid (16x16 cell grid)\n  float gScale = 14.0;\n  vec2 gCell = floor(uv * gScale);\n  vec2 gCenter = (gCell + 0.5) / gScale;\n  vec2 gf = abs(fract(uv * gScale) - 0.5);\n  float gLine = smoothstep(0.47, 0.50, max(gf.x, gf.y));\n  float gNode = smoothstep(0.11, 0.04, length(fract(uv * gScale + 0.5) - 0.5));\n\n  // Accumulate Lagrangian snow density, plastic strain, and P2G Eulerian grid activation\n  float snowDens = 0.0;\n  float strainSum = 0.0;\n  float gridAct = 0.0;\n  float minP = 1e5;\n  for (int i = 0; i < 32; i++) {\n    vec2 pp; float st; float rr;\n    mpmParticle(i, tau, plast, coh, pp, st, rr);\n    float d = length(uv - pp);\n    minP = min(minP, d);\n    float w = exp(-(d * d) / max(rr * rr * 1.15, 1e-5));\n    snowDens += w;\n    strainSum += w * st;\n    // Quadratic B-spline P2G grid weight near current Eulerian cell\n    float dg = length(gCenter - pp);\n    gridAct += exp(-dg * dg * 95.0);\n  }\n\n  // Highlight active P2G Eulerian grid cells carrying transferred momentum\n  if (gridVis > 0.01) {\n    float act = clamp(gridAct * 0.42, 0.0, 1.0);\n    col += vec3(0.12, 0.44, 0.72) * act * 0.34 * gridVis;\n    col += vec3(0.24, 0.46, 0.68) * gLine * (0.14 + 0.45 * act) * gridVis;\n    col += vec3(0.45, 0.86, 1.0) * gNode * act * 0.55 * gridVis;\n  }\n\n  // Rigid basalt impact wedge & snowy ground plane\n  float dWedge = sdTriangle(uv, vec2(-0.04, -0.02), vec2(0.32, -0.35), vec2(0.32, 0.22));\n  float dFloor = -uv.y - 0.35;\n  if (dWedge < 0.0 || dFloor > 0.0) {\n    vec3 rock = vec3(0.13, 0.16, 0.22) * (0.85 + 0.25 * smoothstep(-0.35, 0.2, uv.y));\n    col = mix(col, rock, 0.94);\n  }\n  col = mix(col, vec3(0.58, 0.72, 0.88), smoothstep(px * 3.0, px * 0.6, abs(dWedge)) * 0.85);\n  col = mix(col, vec3(0.48, 0.64, 0.82), smoothstep(px * 2.5, px * 0.5, abs(dFloor)) * 0.75);\n\n  // Shaded MPM Snow Clumps (fresh snow white -> icy blue under high plastic hardening strain!)\n  float snowMask = smoothstep(0.42, 0.72, snowDens);\n  if (snowMask > 0.005) {\n    float avgStrain = strainSum / max(snowDens, 1e-4);\n    float sparkle = fract(sin(dot(floor(fragCoord * 0.75), vec2(12.98, 78.23))) * 43758.5);\n    vec3 freshSnow = vec3(0.92, 0.95, 0.99);\n    vec3 compressedIce = vec3(0.32, 0.74, 0.98);\n    vec3 fracturedTint = vec3(0.98, 0.62, 0.28);\n    vec3 sCol = mix(freshSnow, compressedIce, clamp(avgStrain * 0.85, 0.0, 1.0));\n    sCol = mix(sCol, fracturedTint, smoothstep(0.65, 1.0, avgStrain) * 0.45);\n    // Soft powdery rim lighting + crystalline glint\n    float rim = smoothstep(1.35, 0.45, snowDens);\n    sCol *= (0.76 + 0.26 * rim);\n    sCol += vec3(0.55) * step(0.965, sparkle);\n    col = mix(col, sCol, snowMask);\n  }\n\n  // Crisp Lagrangian material-point cores\n  col = mix(col, vec3(1.0, 0.96, 0.85), smoothstep(0.012, 0.004, minP) * 0.55);\n\n  fragColor = vec4(pow(clamp(aces(col), 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);\n}",
   "execution_fidelity": "conceptual-diagram",
   "proof": {
    "kind": "rendered",
    "label": "rendered 2026-11-30",
    "ok": true,
    "proof": {
     "ok": true,
     "technique": "mpm-snow",
     "runtime": "glsl-fragment",
     "checked_at": "2026-11-30T19:04:35.000Z",
     "renderer": "Headless EGL Tesla T4/PCIe/SSE2, OpenGL 3.30 Core, 512×512, iTime=1.5",
     "stats": {
      "mean": 0.4471,
      "std": 0.1613,
      "min": 0.2358,
      "max": 0.935
     },
     "image": "/specimens/mpm-snow-live.webp",
     "reason": null
    }
   }
  }
 ],
 "related": [
  "flip-pic-fluids",
  "sph-fluids",
  "snow-terrain-deformation"
 ],
 "extends": [],
 "supersedes": [],
 "combines_with": [],
 "provenance": {
  "prose": "original text written for this index (research draft, editorially reviewed)",
  "sources_verified_at": "2026-11-29T15:51:27.588Z",
  "draft": "data/drafts/simulation/mpm-snow.json"
 },
 "solves": [
  "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"
 ],
 "authority": "Stomakhin et al., 2013",
 "url": "https://texelatlas.vercel.app/t/mpm-snow/",
 "execution_fidelity": "conceptual-diagram",
 "fidelity_label": "Visual Diagram",
 "benchmark_eligible": false,
 "gpu_weight": {
  "weight_x": 24.1,
  "tier": "heavy",
  "p50_ms": 0.7567,
  "p95_ms": 0.7741,
  "baseline_p50_ms": 0.0329,
  "gpu": "Tesla T4/PCIe/SSE2",
  "resolution": "1920x1080",
  "method": "opengl-timer-query",
  "frames": 40,
  "preset_id": "mpm-snow-live",
  "execution_fidelity": "conceptual-diagram",
  "fidelity_label": "Visual Diagram",
  "benchmark_eligible": false,
  "generated_at": "2026-11-30T21:07:47Z",
  "l4": {
   "weight_x": 21.44,
   "tier": "heavy",
   "p50_ms": 0.3388,
   "p95_ms": 0.3564,
   "speedup_x": 2.23,
   "gpu": "NVIDIA L4/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0159
  },
  "a100": {
   "weight_x": 15.19,
   "tier": "moderate",
   "p50_ms": 0.4375,
   "p95_ms": 0.4517,
   "speedup_x": 1.73,
   "gpu": "NVIDIA A100-SXM4-40GB/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0288
  }
 }
}