SNOWFLOW
A real-time snow rendering tech demo. WebGPU, Babylon.js, hand-written WGSL.
Everything you see is generated on the GPU at load time — there are no textures,
no meshes, no HDRIs and no animation data in this repository.
▶ snowflow-lilac.vercel.app
Requires a WebGPU-capable desktop browser (Chrome/Edge 113+, Firefox 141+,
Safari 26+) and a discrete or recent integrated GPU. There is no WebGL
fallback by design — if navigator.gpu is missing the page says so and stops.
Controls
| |
|---|
| Click | capture the pointer |
W A S D | move, relative to the camera |
| Mouse | look · Wheel zoom |
Shift | sprint |
| Right mouse (hold) | snow-surf — carve across the field and throw a wake |
1 – 5 | the five spells (2 is a held cast) |
F1 or ` | settings and performance overlay |
The overlay exposes every art parameter as a live slider — sun angle, wind
bearing, subsurface radius, deformation depth, tonemap curve, exposure — plus a
frame-time graph with median / 95th / 1% low, draw calls, triangles and a
per-system CPU breakdown. Every system can be toggled off individually, and
there are debug views for normals, depth, cascade coverage, the deformation
buffer and the raw shadow map.
What it does
Terrain
A nested-ring geometry clipmap: 8 rings, 8.5 cm inner spacing, ~870 m radius,
333k triangles — one static mesh, one draw call. Vertices carry only
(gridIndex, ringLevel); world placement, CDLOD morphing and displacement all
happen in the vertex shader, so there is no CPU rebuild and no per-frame upload.
The heightfield underneath it is layered gradient noise with analytic
derivatives, anisotropic about a single prevailing wind: broad transverse dune
ridges, a long low swell, medium drifts sheared along the wind for lee-face
asymmetry, and sparse rock outcrops. It bakes once into a 4096² RG32F texture
and is mirrored back to the CPU, so character grounding samples exactly the
surface that is drawn rather than a re-implementation of it.
Snow shading
Multi-scale normals — baked macro slope, analytic sastrugi and ripples, three
tiled detail scales, triplanar on steep faces — over wrapped diffuse, a
back-scatter subsurface term with depth-dependent blue tint, GGX specular, SH
ambient with a solved snow bounce, and procedural view-