{
 "id": "snow-terrain-deformation",
 "title": "Real-time snow and terrain deformation",
 "aliases": [
  "deformable snow"
 ],
 "domain": "simulation",
 "subdomain": "terrain interaction",
 "stage": "simulation",
 "realtime": "realtime",
 "platforms": [
  "desktop-gpu",
  "unreal",
  "unity"
 ],
 "year_introduced": 2014,
 "inputs": [
  "heightfield",
  "depth"
 ],
 "outputs": [
  "heightfield",
  "normals"
 ],
 "style": "both",
 "dynamic": "dynamic",
 "summary": "Game technique that renders footprints and trails by writing collider depth into a heightfield or displacement texture and displacing or tessellating the terrain from it.",
 "how_it_works": "A top-down depth render of the moving colliders (feet, vehicles) relative to the ground height is made each frame around the player. Where the collider pushes below the snow surface, the snow height is lowered and the displaced volume is optionally pushed outward as a rim. The result is accumulated in a persistent displacement texture that is scrolled with the player and relaxed or blurred over time so trails slowly fill in or soften. The terrain shader samples this texture to displace tessellated vertices (or uses parallax occlusion), recompute normals and darken or compress the albedo in deformed areas. The Batman: Arkham Origins talk diced snow meshes at runtime for real geometry with shadows.",
 "when_to_use": "Choose it for cheap, local and visually convincing footprints, tire tracks and wading through snow, sand or mud in games. Prefer `mpm-snow` for physically simulated snow with fracture and piling, `stable-fluids` / `sph-fluids` for liquids, and decals for static or distant interaction.",
 "cost": {
  "class": "medium",
  "notes": "Cheap to medium: a small render target plus tessellation or parallax in the terrain shader."
 },
 "failure_modes": [
  "Texture is local to the player, so deformation vanishes or pops when scrolling",
  "Tessellation cracks or silhouette artefacts at deformation edges without crack-free dicing",
  "No volume conservation: displaced snow does not pile unless a rim is added explicitly",
  "Network/replay consistency is hard because state lives in a GPU texture"
 ],
 "sources": [
  {
   "role": "primary",
   "key": "url:https://www.gdcvault.com/play/1020177/Deformable-Snow-Rendering-in-Batman",
   "type": "web",
   "title": "Deformable Snow Rendering in Batman: Arkham Origins",
   "authors": [
    "Colin Barre-Brisebois"
   ],
   "year": null,
   "venue": "GDC 2014",
   "url": "https://www.gdcvault.com/play/1020177/Deformable-Snow-Rendering-in-Batman",
   "ids": {},
   "license": null,
   "extra": {
    "http_status": 200,
    "live": true,
    "archive": {
     "url": "http://web.archive.org/web/20261009101041/https://www.gdcvault.com/play/1020177/Deformable-Snow-Rendering-in-Batman",
     "timestamp": "20261009101041"
    },
    "page_title": "Deformable Snow Rendering in Batman: Arkham Origins",
    "host": "gdcvault.com",
    "title_confirmed_by_page": true,
    "title_unconfirmed": false
   },
   "provenance": {
    "title": {
     "authority": "http",
     "endpoint": "GET https://www.gdcvault.com/play/1020177/Deformable-Snow-Rendering-in-Batman → 200",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "http",
     "endpoint": "GET https://www.gdcvault.com/play/1020177/Deformable-Snow-Rendering-in-Batman → 200",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 1,
   "__bib": "barrebriseboisdeformable"
  }
 ],
 "presets": [
  {
   "id": "snow-terrain-deformation-live",
   "title": "Snow Terrain Deformation — dynamic heightfield trench compression, displaced berms & subsurface glints",
   "runtime": "glsl-fragment",
   "params": {
    "P_TRENCH_DEPTH": 0.24,
    "P_BERM_HEIGHT": 0.14,
    "P_GLINT_GAIN": 1,
    "P_TRAIL_SPEED": 0.9
   },
   "basis": "original",
   "license_note": "MIT — written for this index.",
   "code": "const float P_TRENCH_DEPTH = 0.24; // P Trench Depth [0.06, 0.42, 0.02]\nconst float P_BERM_HEIGHT = 0.14; // P Displaced Berm [0.0, 0.30, 0.01]\nconst float P_GLINT_GAIN = 1.0; // P Crystal Glints [0.0, 2.0, 0.05]\nconst float P_TRAIL_SPEED = 0.9; // P Trail Speed [0.0, 2.2, 0.05]\n\nfloat hash21(vec2 p) {\n  p = fract(p * vec2(127.1, 311.7));\n  p += dot(p, p + 34.5);\n  return fract(p.x * p.y);\n}\n\nfloat noise2(vec2 p) {\n  vec2 i = floor(p);\n  vec2 f = fract(p);\n  f = f * f * (3.0 - 2.0 * f);\n  return mix(\n    mix(hash21(i), hash21(i + vec2(1.0, 0.0)), f.x),\n    mix(hash21(i + vec2(0.0, 1.0)), hash21(i + vec2(1.0, 1.0)), f.x),\n    f.y\n  );\n}\n\n// Compute snow deformation heightfield along a curving trail + discrete boot impressions\nvoid snowField(vec2 xz, float t, float depthG, float bermG, out float h, out float compact) {\n  // Undisturbed undulating snowdrifts\n  float drift = 0.085 * sin(xz.x * 1.4 + xz.y * 0.9) + 0.045 * noise2(xz * 2.2) + 0.014 * noise2(xz * 8.5);\n\n  // Curved S-path collider trail extending behind moving snow-sphere/boot\n  float pathX = 0.42 * sin(xz.y * 0.85 + 0.4);\n  float headZ = 1.1 - mod(t * 0.55, 3.2);\n  float behindMask = smoothstep(headZ - 0.16, headZ + 0.14, xz.y);\n\n  // Lateral distance to trail centerline\n  float dLat = abs(xz.x - pathX);\n  // Continuous sled trough + alternating left/right boot stamps\n  float trough = exp(-pow(dLat / 0.19, 2.0)) * behindMask;\n  float stepPhase = sin(xz.y * 6.5);\n  float footSide = (stepPhase > 0.0) ? 0.11 : -0.11;\n  float footDist = length(vec2(xz.x - pathX - footSide, fract(xz.y * 1.05) - 0.5) * vec2(1.0, 0.55));\n  float bootStamp = exp(-footDist * footDist * 28.0) * behindMask;\n\n  // Volume-conserving displaced snow berm piled along outside edges of trench\n  float berm = exp(-pow((dLat - 0.27) / 0.105, 2.0)) * behindMask;\n\n  compact = clamp(trough * 0.78 + bootStamp * 0.55, 0.0, 1.0);\n  h = drift - compact * depthG + berm * bermG;\n}\n\nfloat mapScene(vec3 p, float t, float depthG, float bermG, out float matId, out float compact) {\n  float h;\n  snowField(p.xz, t, depthG, bermG, h, compact);\n  float dSnow = (p.y - h) * 0.72;\n  matId = 1.0;\n\n  // Moving collider sphere carving the snow trail in real time\n  float headZ = 1.1 - mod(t * 0.55, 3.2);\n  float headX = 0.42 * sin(headZ * 0.85 + 0.4);\n  float dBall = length(p - vec3(headX, 0.06, headZ)) - 0.19;\n  if (dBall < dSnow) {\n    matId = 2.0;\n    return dBall;\n  }\n  return dSnow;\n}\n\nvec3 calcNormal(vec3 p, float t, float depthG, float bermG) {\n  vec2 e = vec2(0.004, 0.0);\n  float m, c;\n  return normalize(vec3(\n    mapScene(p + e.xyy, t, depthG, bermG, m, c) - mapScene(p - e.xyy, t, depthG, bermG, m, c),\n    mapScene(p + e.yxy, t, depthG, bermG, m, c) - mapScene(p - e.yxy, t, depthG, bermG, m, c),\n    mapScene(p + e.yyx, t, depthG, bermG, m, c) - mapScene(p - e.yyx, t, depthG, bermG, m, c)\n  ));\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 depthG = clamp(P_TRENCH_DEPTH, 0.04, 0.45);\n  float bermG = clamp(P_BERM_HEIGHT, 0.0, 0.35);\n  float glintG = clamp(P_GLINT_GAIN, 0.0, 2.2);\n  float t = iTime * max(P_TRAIL_SPEED, 0.0);\n\n  vec3 ro = vec3(0.65, 1.38, 2.05);\n  vec3 ta = vec3(0.0, -0.10, -0.35);\n  vec3 fwd = normalize(ta - ro);\n  vec3 right = normalize(cross(fwd, vec3(0.0, 1.0, 0.0)));\n  vec3 up = cross(right, fwd);\n  vec3 rd = normalize(fwd * 1.55 + right * uv.x + up * uv.y);\n\n  // Crisp alpine winter sky gradient\n  vec3 col = mix(vec3(0.52, 0.68, 0.88), vec3(0.14, 0.28, 0.56), smoothstep(-0.15, 0.65, rd.y));\n\n  float tHit = 0.0;\n  float matId = 0.0;\n  float compact = 0.0;\n  bool hit = false;\n  for (int i = 0; i < 72; i++) {\n    vec3 p = ro + rd * tHit;\n    float d = mapScene(p, t, depthG, bermG, matId, compact);\n    if (d < 0.0025) { hit = true; break; }\n    tHit += d;\n    if (tHit > 12.0) break;\n  }\n\n  if (hit) {\n    vec3 p = ro + rd * tHit;\n    vec3 n = calcNormal(p, t, depthG, bermG);\n    vec3 lDir = normalize(vec3(0.68, 0.55, 0.45));\n    float diff = max(dot(n, lDir), 0.0);\n    float wrap = max((dot(n, lDir) + 0.45) / 1.45, 0.0);\n    vec3 hVec = normalize(lDir - rd);\n\n    if (matId > 1.5) {\n      // Matte charcoal-orange weighted test sphere carving the trench\n      float spec = pow(max(dot(n, hVec), 0.0), 42.0);\n      vec3 ballCol = mix(vec3(0.86, 0.34, 0.16), vec3(0.22, 0.26, 0.32), smoothstep(-0.08, 0.08, sin(p.y * 22.0)));\n      col = ballCol * (0.22 + 0.85 * diff) + vec3(0.95) * spec * 0.48;\n    } else {\n      // Compacted snow absorbs warm light & shifts icy-cyan; powdery berms scatter warm sunlit SSS\n      vec3 snowAlb = mix(vec3(0.92, 0.95, 0.99), vec3(0.56, 0.74, 0.94), compact * 0.72);\n      vec3 skyAmb = vec3(0.26, 0.42, 0.68) * (0.5 + 0.5 * n.y);\n      vec3 sunLit = vec3(1.18, 1.08, 0.94) * (0.65 * diff + 0.35 * wrap);\n\n      // High-frequency snow crystal specular glints\n      vec2 microCell = floor(p.xz * 48.0);\n      float rndG = hash21(microCell);\n      vec3 microN = normalize(n + vec3(rndG - 0.5, 0.0, hash21(microCell + 19.3) - 0.5) * 0.65);\n      float glint = pow(max(dot(microN, hVec), 0.0), 96.0) * step(0.72, rndG) * (1.0 - compact * 0.65);\n\n      col = snowAlb * (skyAmb * 0.55 + sunLit * 0.85) + vec3(1.0, 0.98, 0.92) * glint * 1.65 * glintG;\n      // Subtle atmospheric depth mist\n      float fog = 1.0 - exp(-tHit * tHit * 0.022);\n      col = mix(col, vec3(0.56, 0.70, 0.86), clamp(fog, 0.0, 0.78));\n    }\n  }\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": "snow-terrain-deformation",
     "runtime": "glsl-fragment",
     "checked_at": "2026-11-30T19:53:36.000Z",
     "renderer": "Headless EGL Tesla T4/PCIe/SSE2, OpenGL 3.30 Core, 512×512, iTime=1.5",
     "stats": {
      "mean": 0.828,
      "std": 0.0897,
      "min": 0.2631,
      "max": 0.9415
     },
     "image": "/specimens/snow-terrain-deformation-live.webp",
     "reason": null
    }
   }
  }
 ],
 "related": [
  "mpm-snow",
  "stable-fluids"
 ],
 "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/snow-terrain-deformation.json"
 },
 "solves": [
  "characters should leave footprints in snow or sand",
  "tire tracks in mud on a game terrain",
  "wading through ground that stays dented",
  "cheap trails without full simulation",
  "terrain should dent where objects touch it"
 ],
 "authority": "Barre-Brisebois",
 "url": "https://texelatlas.vercel.app/t/snow-terrain-deformation/",
 "execution_fidelity": "conceptual-diagram",
 "fidelity_label": "Visual Diagram",
 "benchmark_eligible": false,
 "gpu_weight": {
  "weight_x": 86.55,
  "tier": "extreme",
  "p50_ms": 2.683,
  "p95_ms": 2.7601,
  "baseline_p50_ms": 0.0329,
  "gpu": "Tesla T4/PCIe/SSE2",
  "resolution": "1920x1080",
  "method": "opengl-timer-query",
  "frames": 36,
  "preset_id": "snow-terrain-deformation-live",
  "execution_fidelity": "conceptual-diagram",
  "fidelity_label": "Visual Diagram",
  "benchmark_eligible": false,
  "generated_at": "2026-11-30T21:07:47Z",
  "l4": {
   "weight_x": 82.53,
   "tier": "extreme",
   "p50_ms": 1.3123,
   "p95_ms": 1.3427,
   "speedup_x": 2.04,
   "gpu": "NVIDIA L4/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0159
  },
  "a100": {
   "weight_x": 59.9,
   "tier": "heavy",
   "p50_ms": 1.7252,
   "p95_ms": 1.7336,
   "speedup_x": 1.56,
   "gpu": "NVIDIA A100-SXM4-40GB/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0288
  }
 }
}