02. SNOW SIMULATION

Snow as a fracturing continuum.

Snow is not quite a solid and not quite a fluid. It piles, fractures, compacts, and flows depending on how you push it. Simulating it convincingly is what the Material Point Method was designed for. This page shows it implemented from scratch in Rust, in both two and three dimensions, compiled to WebAssembly so you can throw snowballs at walls in your browser.

A continuum that fractures

In 2013, Alexey Stomakhin and his collaborators introduced a Material Point Method variant tuned specifically for snow. Their formulation tracks deformation through two multiplicative parts of the deformation gradient (elastic and plastic) and lets snow forget deformation past a critical threshold. The result is snowballs that smash, snowmen that wobble, and walls that pile drifts on the windward edge.

2D, the algorithm playground

A 64 by 64 grid is enough to see every step of the pipeline. Two patches of particles fly toward each other and squish on contact. Pull the sliders to feel each parameter. Young’s modulus controls stiffness. Gravity controls drift versus pile. Particle density controls visual detail.

snow mpm 2d. rust plus macroquad. wasm.
Loading demo…

3D, the production scene

The extension to three dimensions is conceptually trivial (an extra index everywhere) but the rendering cost flips the bottleneck from algorithm to GPU. The 3D version uses the three d crate, which gives an OpenGL pipeline with a WebGL2 backend, so the same Rust code that renders natively also runs in your browser. Try snowman fifteen for a gentle throw that deforms but does not shatter; wall hit for high velocity impact and spatter; snowball smash for two opposing patches with cranked hardening that produces visible cracks.

snow mpm 3d. rust plus three d. wasm and webgl2.
Loading demo…