threejs-worldgen
    Preparing search index...

    Function createVegetationLayers

    • Builds scatter layers for a set of species: a few generated variants each, with a full mesh, a simplified mesh and (with a renderer) a baked impostor, plus placement rules. Variants of a species share one blue-noise point set, so they never overlap; give several species the same group to make them share one too (a mixed canopy).

      Pass the result as layers to a Scatter; free it with disposeLayers from threejs-scatter.

      Parameters

      Returns Promise<ScatterLayer[]>

      const layers = await createVegetationLayers({
      species: [{ name: 'oak', density: 0.5, group: 'canopy' }, { name: 'beech', density: 0.4, group: 'canopy' }, { name: 'fern', density: 0.6 }],
      renderer,
      })
      Scatter.create({ camera, scene, terrain, layers })