threejs-worldgen
    Preparing search index...

    Interface ScatterLayer

    One kind of scattered object (a tree species variant, a rock type, a shrub…): where it grows (PlacementRules) and how it is drawn at each distance. lods, impostor and a function density are the only non-JSON fields.

    interface ScatterLayer {
        align: number;
        castShadow: boolean;
        cluster: ScatterCluster | null;
        colorVariation: number;
        density: number | DensityFn;
        group?: string;
        impostor: ScatterLOD | null;
        lods: ScatterLOD[];
        maxHeight: number;
        maxSlope: number;
        minHeight: number;
        minSlope: number;
        name: string;
        randomYaw: boolean;
        receiveShadow: boolean;
        scale: [min: number, max: number];
        sink: number;
        spacing: number;
        tilt: number;
    }

    Hierarchy (View Summary)

    Index
    align: number

    0 = stand upright, 1 = tilt fully onto the terrain normal (rocks), anything between blends.

    castShadow: boolean

    Whether instances cast shadows (can be overridden per level).

    cluster: ScatterCluster | null

    Clumping into patches and clearings, or null for an even spread.

    colorVariation: number

    Per-instance brightness variation, 0..1, sent as scatterParams.y: multiply it into your material's colorNode (scatterParamsNode().y) before any weather, so snow and ash stay untinted. Not sent as instanceColor, which three.js multiplies in after colorNode.

    density: number | DensityFn

    Probability (0..1) of keeping each blue-noise point, constant or per world position. The function form lets biome weights drive it. Within a group, densities that add up to more than 1 are normalised.

    group?: string

    Layers with the same group share one blue-noise point set and never overlap: each point goes to at most one layer, chosen by comparing a per-point random number against the layers' densities (in layer order). The group's spacing is the first layer's. Defaults to the layer's own name (its own point set).

    impostor: ScatterLOD | null

    Far level drawn after the last mesh level, typically from bakeImpostor(). Unlike mesh levels it is not an InstancedMesh: its material reads two per-instance attributes, scatterPosition (xyz = base position, w = scale) and scatterParams (x = yaw, y = brightness tint, z = random 0..1).

    lods: ScatterLOD[]

    Mesh levels of detail, nearest first, with ascending distance.

    maxHeight: number

    Highest terrain height, in metres.

    maxSlope: number

    Steepest terrain slope (rise / run) that gets instances. Infinity = no limit.

    minHeight: number

    Lowest terrain height, in metres.

    minSlope: number

    Lowest terrain slope (rise / run) that gets instances.

    name: string

    Layer name. Also seeds the layer's clumping noise, so renaming a layer moves its patches.

    randomYaw: boolean

    Turn each instance by a random angle around its up axis.

    receiveShadow: boolean

    Whether instances receive shadows.

    scale: [min: number, max: number]

    Uniform scale range [min, max]; each instance picks a random value in it.

    sink: number

    How far each instance is pushed into the ground, in metres (hides the base on slopes).

    spacing: number

    Minimum distance between instances, in metres (Poisson-disk radius).

    tilt: number

    Maximum random lean of each instance away from vertical, in radians (applied before align).