Configuration

These are the properties accepted by Grassworks.create(). Every property is independently addressable so configuration questions can link directly to the relevant entry.

js
const grassworks = await Grassworks.create({
  camera, scene, renderer, terrain,
  tileSize: 25,
  maxDistance: 200
});

camera

Type THREE.CameraRequired YesDefault

Grassworks camera used for visibility and LOD.

scene

Type THREE.SceneRequired YesDefault

Scene that receives the generated grass tiles.

renderer

Type WebGPURendererRequired YesDefault

WebGPU renderer required by Grassworks.

Grassworks requires WebGPURenderer; WebGLRenderer is not supported.

terrain

Type THREE.Object3DRequired YesDefault

Plane-based terrain mesh.

The supported terrain model is a plane-based Three.js terrain surface.

tileSize

Type numberRequired YesDefault

Must be greater than 0.

maxDistance

Type numberRequired YesDefault

Must be greater than 0.

grassType

Type "blade" | "billboard"Required NoDefault "blade"

Selects the grass representation.

grassAtlas

Type stringRequired ConditionalDefault

Required for Billboard grass.

Used by Billboard grass. The atlas source is divided with atlasColumns and atlasRows inside grassParams.

grassMap

Type stringRequired NoDefault null

Path or URL to a grass map.

See the Grass Maps Guide for mapping behavior and formats.

grassParams

Type objectRequired NoDefault {}

Grass parameter overrides.

preset

Type stringRequired NoDefault default

Named Blade preset.

Named presets are Blade-only. Billboard has a default configuration but no named preset library.

interactionWorldSize

Type numberRequired NoDefault maxDistance / 2

World coverage of the camera-following interaction map.

interactionResolution

Type integerRequired NoDefault 256

Resolution of the interaction map.

influenceRecoverySpeed

Type numberRequired NoDefault 0.99

Must be between 0 and 1.

influenceDebugPlaneVisible

Type booleanRequired NoDefault false

Controls the interaction debug plane.

painter

Type objectRequired NoDefault enabled false; flipU false; flipV true; quality low

Terrain Painter configuration.

lod

Type objectRequired NoDefault high / medium / low / veryLow

Overrides the four LOD configurations.

castShadow

Type booleanRequired NoDefault false

Sets generated grass meshes to cast shadows.

receiveShadow

Type booleanRequired NoDefault true

Sets generated grass meshes to receive shadows.