threejs-worldgen
    Preparing search index...

    Interface MPMProps

    Props of <MPM>: every MPMInput setting plus the ones below.

    interface MPMProps {
        capacity?: number;
        cellSize?: number;
        cfl?: number;
        emit?: MPMEmit[];
        friction?: number;
        gravity?: [number, number, number];
        height?: MPMHeightFn | null;
        materials?: {
            [key: string]: { [key: string]: number | undefined } | undefined;
        };
        maxSpeed?: number;
        maxSubsteps?: number;
        origin?: [number, number, number];
        ref?: Ref<MPMSolver | null>;
        render?: {
            colors?: string[];
            opacity?: number;
            size?: number;
            strainScale?: number;
        };
        resolution?: [number, number, number];
        seed?: string | number;
        substeps?: number;
        timeStep?: number;
        walls?: boolean;
    }

    Hierarchy (View Summary)

    Index
    capacity?: number

    Most particles. Fixed at construction.

    cellSize?: number

    Grid spacing Δx, metres. Particles are emitted 2 per cell per axis (8 per cell). Fixed at construction.

    cfl?: number

    Courant number C of the stable step dt ≤ C·Δx / (maxSpeed + sound speed) (see mpmStableStep).

    emit?: MPMEmit[]

    Blocks emitted once, whenever the solver is (re)built. Emit more through the ref.

    friction?: number

    Terrain friction coefficient (Coulomb): 0 slips, large values stick.

    gravity?: [number, number, number]

    Gravity, m/s².

    height?: MPMHeightFn | null

    Terrain height function, world metres (re-baked when it changes).

    materials?: { [key: string]: { [key: string]: number | undefined } | undefined }

    Materials compiled in (keys, fixed at construction) and their parameters (live).

    maxSpeed?: number

    Particle speed limit, m/s: the "max particle speed" of the stable step, enforced in G2P.

    maxSubsteps?: number

    Most substeps per frame; past it the simulation runs slower than real time instead of going unstable.

    origin?: [number, number, number]

    World position of the domain's minimum corner, metres. Moving it shifts the domain by whole cells (the particles keep their world positions; those left outside freeze). Floating-origin safe: the GPU only sees positions relative to it.

    ref?: Ref<MPMSolver | null>

    Receives the MPMSolverImpl instance.

    render?: {
        colors?: string[];
        opacity?: number;
        size?: number;
        strainScale?: number;
    }

    Drawing through the particle pool's unlit shading.

    Type Declaration

    • Optionalcolors?: string[]

      Colour ramp by volume change J: first key squashed, middle at rest, last stretched (1 to 8 #rrggbb).

    • Optionalopacity?: number

      Opacity.

    • Optionalsize?: number

      Sprite width, in particle spacings (Δx / 2).

    • OptionalstrainScale?: number

      How much volume change spans the colour ramp: key = 0.5 + (J − 1) × strainScale.

    resolution?: [number, number, number]

    Grid nodes along x, y, z (8…160 each). Fixed at construction.

    seed?: string | number

    Seed for the emission jitter.

    substeps?: number

    Substeps per frame at least. More are added when the frame is longer than the stable step allows.

    timeStep?: number

    Seconds simulated per frame: default the frame's delta; a fixed step (e.g. 1 / 60) is deterministic and slows down rather than going unstable when frames drop. 0: not stepped here (step it through the ref, or let <MPMLava>).

    walls?: boolean

    Domain sides act as slip walls (else particles that leave the domain freeze).