NatureGL Grassv1.1.0

More

Changelog

Every release of naturegl-grass. The package follows semantic versioning.

#1.1.0

2026-09-24

#Fixed

  • addFlowers(), addRocks(), addTrees() and addBushes() silently dropped layer options they did not name. They now forward filter, maskPower, maxSlope, cluster, seed, sink, chunkSize, fade and name to addLayer(). Explicit values override the layer's defaults, and undefined keeps them. The .set({ filter }) workaround is no longer needed. Read more.
js
scatter.addBushes({ density: 0.01, filter: (x, z, y) => y > 1.5, maskPower: 2 });

#1.0.0

2026-09-24 The first release, packaged from grasspro.html (three 0.160, a single-file page).

#Added

  • GrassSystem. Camera-following chunked tiles in 3 LOD rings, with CPU frustum and distance culling per chunk and front-to-back chunk order. There is one instanced draw per ring, and all per-blade work runs in a per-frame blade pass (MRT float targets, one texel per blade).
  • Terrain contract. heightAt, bounds, mask and colorAt are baked to textures (TerrainField), so the grass works on any terrain. setTerrain() re-bakes.
  • WindField. A shared gust field with getUniforms(), WindField.glsl, a CPU sample(), and patchMaterial() for built-in materials. The patch works on instanced meshes and depth materials, can take trample, and chains with other onBeforeCompile hooks.
  • TrampleField. A camera-following ±80 m buffer with 16 stamps per frame, addTrampler(object3D, radius), one-shot stamp(), and lift-off detection.
  • Lighting and shadows. setLighting() and bindLights(directional, hemisphere) read light values in three.js units. The grass receives the directional light's PCF shadow map through sampler2DShadow, and setCloudShadow({ texture, matrix }) adds cloud shadows.
  • patchTerrainMaterial(). Paints the grass turf colour on your ground, so there is no LOD ring.
  • Blade look. Voronoi clumping that shares height and tint and splays outward, dry tips, root AO that depends on density, reworked translucency, an anisotropic sheen along the blade, and gust sheen waves.
  • ScatterSystem. Streamed, deterministic instanced props with distance fade, plus addFlowers, addRocks, addTrees and addBushes, custom layers, explicit placements and per-instance colour.
  • Fireflies. Terrain-hugging, and suppressed where the mask is 0.
  • Presets and quality. 7 presets (one file each), getPresetParams, and QUALITY_LEVELS from low to ultra.
  • Demo. A full port of the meadow scene: day cycle, sky, fireflies, drifting leaves and fluff, the rolling ball that tramples, the cursor brush, and all the original UI. New in the demo: clumping, glow and sheen sliders, a Path toggle (the mask in use), a Copy preset JSON button, the window.__pro contract, and the ?quality, ?smoke and ?gputime URL options.
  • Examples. examples/basic (Vite) and examples/cdn (import map + build/).
  • Scripts. scripts/smoke.mjs, a real-GPU headless test that fails on GL errors; scripts/check-examples.mjs, which checks both examples; and the dev tools scripts/shots.mjs, scripts/shots-orig.mjs (parity with the original) and scripts/bench.mjs (A/B GPU timing).

#Changed from grasspro.html

  • three.js upgrade. three 0.186, with THREE.Timer in place of Clock and PCFShadowMap in place of the removed PCFSoftShadowMap.
  • Lighting. Grass shading uses physically based light units, and the demo scales its lights by π to keep the original look.
  • Leaf translucency now comes from behind the leaf. The original was front-lit by mistake.
  • Demo textures are DataTextures rather than canvas.