Debugging
Grassworks exposes numerical and visual diagnostics so you can understand tile visibility, LOD distribution, grass instance counts and interaction-map coverage.
Read the statistics
js
const stats = grassworks.getStats();
console.log(stats.visibleTiles);
console.log(stats.culledTiles);
console.log(stats.tilesPerLOD);
console.log(stats.blades);getStats() also reports the current enabled/visible state, grass type, tile count, tile size, maximum distance, interaction state and painter state. See the getStats() API entry for the exact returned structure.
Visual tile diagnostics
Enable debugBoxes to see tile boundaries and inspect how the current grid and culling decisions relate to the camera.
js
grassworks.setDebugBoxes(true);Interaction diagnostics
Enable the influence debug plane when interaction bending is difficult to tune. It shows the active interaction-map coverage so you can judge interactionWorldSize and interactionResolution together.
js
grassworks.setInfluenceDebugPlaneVisible(true);Useful diagnosis sequence
- Check that the renderer is
WebGPURenderer. - Check that
grassworks.update(timer)runs every frame. - Inspect
getStats()for visible/cull and LOD distribution. - Enable debug boxes when tile behavior is unclear.
- Enable the interaction debug plane when influence coverage is unclear.
- If terrain changed after initialization, call refreshTerrain().