Tiling & Culling

Grassworks divides the field into world-space tiles and continuously manages which tiles are relevant to the camera.

tileSize

tileSize is the world-space size of one grass tile. Smaller tiles allow finer separation for culling and LOD, but create more tiles and more management/draw-call overhead. Larger tiles reduce that overhead but make spatial decisions coarser.

maxDistance

maxDistance defines how far grass remains visible from the camera. Raising it preserves distant coverage while keeping more grass active. Lowering it reduces work but ends the grass field sooner.

Camera-following tile grid

As the camera crosses tile boundaries, Grassworks repositions its tile grid around the camera. This allows the system to manage a large world without requiring a fixed grass tile at every possible location.

Debug boxes

Enable debugBoxes to see tile boundaries and inspect how many tiles are being rendered. It is especially useful while tuning tileSize, maxDistance and LOD distances.

js
grassworks.setTileSize(20);
grassworks.setMaxDistance(150);
grassworks.setDebugBoxes(true);