threejs-worldgen
    Preparing search index...

    Class MPMSnowSurface

    Draws an MPMSolver's snow as a continuous snow cover: each frame the snow particles splat their current volume (rest volume × det F × Jp, so compaction shows as a depression) into a column grid over the domain with quadratic B-spline weights, a pass smooths it, and a heightfield mesh on the terrain is displaced by it and shaded with snowMaterial (compacted snow by its mean Jp). Footprints, tracks, slumps and avalanche debris all read as one surface; airborne snow lands in the column below it. Hide the solver's particles (object.visible = false).

    const snow = new MPMSnowSurface(renderer, mpm, { edgeDepth: 0.3 })
    scene.add(snow.object)
    renderer.setAnimationLoop(() => { mpm.step(1 / 60); snow.update(); renderer.render(scene, camera) })
    Index
    columns: [number, number]

    Column samples along x and z.

    object: Mesh<
        BufferGeometry<NormalBufferAttributes, BufferGeometryEventMap>,
        MeshSSSNodeMaterial,
    >

    The surface mesh (add it to the scene; it follows the solver's origin).

    Resolved settings.

    shading: SnowShading

    Shading uniforms.

    surface: any

    Per column: x surface height (local to the solver's origin), y snow depth, z mean Jp, w debris (0…1).

    • The surface's compute passes for this frame (splat, resolve, smooth), to batch in one renderer.compute([...]).

      Returns ComputeNode[]