More
Changelog
Every release of naturegl-grass. The package follows semantic versioning.
#1.1.0
2026-09-24
#Fixed
addFlowers(),addRocks(),addTrees()andaddBushes()silently dropped layer options they did not name. They now forwardfilter,maskPower,maxSlope,cluster,seed,sink,chunkSize,fadeandnametoaddLayer(). Explicit values override the layer's defaults, andundefinedkeeps them. The.set({ filter })workaround is no longer needed. Read more.
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,maskandcolorAtare baked to textures (TerrainField), so the grass works on any terrain.setTerrain()re-bakes. WindField. A shared gust field withgetUniforms(),WindField.glsl, a CPUsample(), andpatchMaterial()for built-in materials. The patch works on instanced meshes and depth materials, can take trample, and chains with otheronBeforeCompilehooks.TrampleField. A camera-following ±80 m buffer with 16 stamps per frame,addTrampler(object3D, radius), one-shotstamp(), and lift-off detection.- Lighting and shadows.
setLighting()andbindLights(directional, hemisphere)read light values in three.js units. The grass receives the directional light's PCF shadow map throughsampler2DShadow, andsetCloudShadow({ 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, plusaddFlowers,addRocks,addTreesandaddBushes, 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, andQUALITY_LEVELSfrom 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.__procontract, and the?quality,?smokeand?gputimeURL options. - Examples.
examples/basic(Vite) andexamples/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 toolsscripts/shots.mjs,scripts/shots-orig.mjs(parity with the original) andscripts/bench.mjs(A/B GPU timing).
#Changed from grasspro.html
- three.js upgrade. three 0.186, with
THREE.Timerin place ofClockandPCFShadowMapin place of the removedPCFSoftShadowMap. - 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.