Real-time snow and terrain deformation
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.
Also known as deformable snow
In the family Simulation & animation, terrain interaction
Where it runs
Built inOfficial add-onPluginNone foundNot researched
| Engine | Support | How |
|---|---|---|
| three.js r187 | None found | |
| Babylon.js 9.38.0 | None found | |
| Godot 4.7 | None found | No built-in real-time snow/terrain heightmap deformation system. |
| Unity | None found | |
| Unreal 5.7 | None found | |
| Blender 5.2 | None found | |
| WebGPU W3C | None found | |
| Metal | None found |
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 choose it
Reach for it when
- 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
Choose it for cheap, local and visually convincing footprints, tire tracks and wading through snow, sand or mud in games. Prefer Material Point Method (snow) for physically simulated snow with fracture and piling, Stable Fluids / Smoothed Particle Hydrodynamics (fluids) for liquids, and decals for static or distant interaction.
Field marks
- 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
Presets
Snow Terrain Deformation — dynamic heightfield trench compression, displaced berms & subsurface glints
{
"P_TRENCH_DEPTH": 0.24,
"P_BERM_HEIGHT": 0.14,
"P_GLINT_GAIN": 1,
"P_TRAIL_SPEED": 0.9
}Show GLSL (143 lines)
const float P_TRENCH_DEPTH = 0.24; // P Trench Depth [0.06, 0.42, 0.02]
const float P_BERM_HEIGHT = 0.14; // P Displaced Berm [0.0, 0.30, 0.01]
const float P_GLINT_GAIN = 1.0; // P Crystal Glints [0.0, 2.0, 0.05]
const float P_TRAIL_SPEED = 0.9; // P Trail Speed [0.0, 2.2, 0.05]
float hash21(vec2 p) {
p = fract(p * vec2(127.1, 311.7));
p += dot(p, p + 34.5);
return fract(p.x * p.y);
}
float noise2(vec2 p) {
vec2 i = floor(p);
vec2 f = fract(p);
f = f * f * (3.0 - 2.0 * f);
return mix(
mix(hash21(i), hash21(i + vec2(1.0, 0.0)), f.x),
mix(hash21(i + vec2(0.0, 1.0)), hash21(i + vec2(1.0, 1.0)), f.x),
f.y
);
}
// Compute snow deformation heightfield along a curving trail + discrete boot impressions
void snowField(vec2 xz, float t, float depthG, float bermG, out float h, out float compact) {
// Undisturbed undulating snowdrifts
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);
// Curved S-path collider trail extending behind moving snow-sphere/boot
float pathX = 0.42 * sin(xz.y * 0.85 + 0.4);
float headZ = 1.1 - mod(t * 0.55, 3.2);
float behindMask = smoothstep(headZ - 0.16, headZ + 0.14, xz.y);
// Lateral distance to trail centerline
float dLat = abs(xz.x - pathX);
// Continuous sled trough + alternating left/right boot stamps
float trough = exp(-pow(dLat / 0.19, 2.0)) * behindMask;
float stepPhase = sin(xz.y * 6.5);
float footSide = (stepPhase > 0.0) ? 0.11 : -0.11;
float footDist = length(vec2(xz.x - pathX - footSide, fract(xz.y * 1.05) - 0.5) * vec2(1.0, 0.55));
float bootStamp = exp(-footDist * footDist * 28.0) * behindMask;
// Volume-conserving displaced snow berm piled along outside edges of trench
float berm = exp(-pow((dLat - 0.27) / 0.105, 2.0)) * behindMask;
compact = clamp(trough * 0.78 + bootStamp * 0.55, 0.0, 1.0);
h = drift - compact * depthG + berm * bermG;
}
float mapScene(vec3 p, float t, float depthG, float bermG, out float matId, out float compact) {
float h;
snowField(p.xz, t, depthG, bermG, h, compact);
float dSnow = (p.y - h) * 0.72;
matId = 1.0;
// Moving collider sphere carving the snow trail in real time
float headZ = 1.1 - mod(t * 0.55, 3.2);
float headX = 0.42 * sin(headZ * 0.85 + 0.4);
float dBall = length(p - vec3(headX, 0.06, headZ)) - 0.19;
if (dBall < dSnow) {
matId = 2.0;
return dBall;
}
return dSnow;
}
vec3 calcNormal(vec3 p, float t, float depthG, float bermG) {
vec2 e = vec2(0.004, 0.0);
float m, c;
return normalize(vec3(
mapScene(p + e.xyy, t, depthG, bermG, m, c) - mapScene(p - e.xyy, t, depthG, bermG, m, c),
mapScene(p + e.yxy, t, depthG, bermG, m, c) - mapScene(p - e.yxy, t, depthG, bermG, m, c),
mapScene(p + e.yyx, t, depthG, bermG, m, c) - mapScene(p - e.yyx, t, depthG, bermG, m, c)
));
}
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 depthG = clamp(P_TRENCH_DEPTH, 0.04, 0.45);
float bermG = clamp(P_BERM_HEIGHT, 0.0, 0.35);
float glintG = clamp(P_GLINT_GAIN, 0.0, 2.2);
float t = iTime * max(P_TRAIL_SPEED, 0.0);
vec3 ro = vec3(0.65, 1.38, 2.05);
vec3 ta = vec3(0.0, -0.10, -0.35);
vec3 fwd = normalize(ta - ro);
vec3 right = normalize(cross(fwd, vec3(0.0, 1.0, 0.0)));
vec3 up = cross(right, fwd);
vec3 rd = normalize(fwd * 1.55 + right * uv.x + up * uv.y);
// Crisp alpine winter sky gradient
vec3 col = mix(vec3(0.52, 0.68, 0.88), vec3(0.14, 0.28, 0.56), smoothstep(-0.15, 0.65, rd.y));
float tHit = 0.0;
float matId = 0.0;
float compact = 0.0;
bool hit = false;
for (int i = 0; i < 72; i++) {
vec3 p = ro + rd * tHit;
float d = mapScene(p, t, depthG, bermG, matId, compact);
if (d < 0.0025) { hit = true; break; }
tHit += d;
if (tHit > 12.0) break;
}
if (hit) {
vec3 p = ro + rd * tHit;
vec3 n = calcNormal(p, t, depthG, bermG);
vec3 lDir = normalize(vec3(0.68, 0.55, 0.45));
float diff = max(dot(n, lDir), 0.0);
float wrap = max((dot(n, lDir) + 0.45) / 1.45, 0.0);
vec3 hVec = normalize(lDir - rd);
if (matId > 1.5) {
// Matte charcoal-orange weighted test sphere carving the trench
float spec = pow(max(dot(n, hVec), 0.0), 42.0);
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)));
col = ballCol * (0.22 + 0.85 * diff) + vec3(0.95) * spec * 0.48;
} else {
// Compacted snow absorbs warm light & shifts icy-cyan; powdery berms scatter warm sunlit SSS
vec3 snowAlb = mix(vec3(0.92, 0.95, 0.99), vec3(0.56, 0.74, 0.94), compact * 0.72);
vec3 skyAmb = vec3(0.26, 0.42, 0.68) * (0.5 + 0.5 * n.y);
vec3 sunLit = vec3(1.18, 1.08, 0.94) * (0.65 * diff + 0.35 * wrap);
// High-frequency snow crystal specular glints
vec2 microCell = floor(p.xz * 48.0);
float rndG = hash21(microCell);
vec3 microN = normalize(n + vec3(rndG - 0.5, 0.0, hash21(microCell + 19.3) - 0.5) * 0.65);
float glint = pow(max(dot(microN, hVec), 0.0), 96.0) * step(0.72, rndG) * (1.0 - compact * 0.65);
col = snowAlb * (skyAmb * 0.55 + sunLit * 0.85) + vec3(1.0, 0.98, 0.92) * glint * 1.65 * glintG;
// Subtle atmospheric depth mist
float fog = 1.0 - exp(-tHit * tHit * 0.022);
col = mix(col, vec3(0.56, 0.70, 0.86), clamp(fog, 0.0, 0.78));
}
}
fragColor = vec4(pow(clamp(aces(col), 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);
}Attribution: MIT — written for this index.
Measured GPU weight & timing
| Preset | GPU | Weight / p50 / p95 | Method |
|---|---|---|---|
| snow-terrain-deformation-live | Tesla T4 1920x1080 | 86.5× baseline (extreme) · 2.68 ms / 2.76 ms | opengl-timer-query · 36 frames · GPU Weight Atlas · Colab T4 sweep |
| snow-terrain-deformation-live | NVIDIA L4 1920x1080 | 82.5× baseline (extreme) · 1.31 ms / 1.34 ms · 2.0× faster on L4 | opengl-timer-query · Cross-architecture validation |
| snow-terrain-deformation-live | NVIDIA A100-SXM4-40GB 1920x1080 | 59.9× baseline (heavy) · 1.73 ms / 1.73 ms · 1.6× faster on A100 | opengl-timer-query · Cross-architecture validation |
Crosses
- Dynamic surfel GI inside carved snow trenches and footprints: Deep footprints, vehicle tracks, and plowed snow berms dynamically shift real-time bounce lighting — casting cool blue sky-filled shadows inside fresh trenches and warm sunlight bounce off steep compressed snow walls.
Sources
- primaryColin Barre-Brisebois. Deformable Snow Rendering in Batman: Arkham Origins. GDC 2014.Verified via live page · 2026-11-29