NatureGL Grassv1.1.0

Reference

Grass parameters

Every look control the grass has. They live in two sections, grass and wind, and you change them with setParams(). Fields you leave out keep their value.

js
grass.setParams({
  grass: { density: 0.9, height: 1.2, season: 0.35 },
  wind: { speed: 0.8, direction: 120 },
});
grass.params;       // the current grass section (read-only: use setParams)
grass.getParams();  // both sections, plus scatter / environment from the last preset

Changes apply on the next frame. None of them re-bakes or rebuilds anything.

#grass

FieldDefaultRangeEffect
density10..1Blade coverage. It also thins the turf colour on the ground
height10.3..2Height multiplier. At 1 the blades are about 0.3–1.0 m
width10.5..2Width multiplier on each ring's blade width
season0.120..1Colour palette: 0 lush spring, 0.35 summer, 0.7 autumn, 1 dry savanna
clumping0.550..1Tufts that share height and tint, with blades splaying outward
translucency10..2Glow when back-lit
specular10..2Anisotropic sheen along the blade
gustSheen10..2How strongly gust fronts brighten the field

The defaults are what setParams() fills in for a field that was never set. create() loads meadow unless you pass another preset.

#wind

Fieldnew WindField() defaultRangeEffect
speed0.50..2Wind strength, and the speed of the gust fronts
gust0.60..1.5Strength of the gust fronts on top of the steady wind
direction40degreesWhere the wind blows towards. 0 = +X, 90 = +Z

See Wind field for what they do to the blades and to patched materials.

#Seasons

season interpolates between four palette keys. grass.colors holds the current result as linear THREE.Colors: base, tip, dry and leaf. leaf suits trees and bushes, and the demo copies it onto its tree leaves.

seasonKeyBase → tip
0Lush springdeep green → bright green
0.35Summergreen → yellow-green
0.7Autumnbrown → russet, with orange leaves
1Dry savannabrown → straw
js
import { SEASONS, seasonColors } from 'naturegl-grass';

const { base, tip, dry, leaf } = seasonColors(0.5);   // between summer and autumn
treeLeaves.color.copy(grass.colors.leaf);

#Demo sliders

The demo's sliders map onto these fields with these ranges:

SliderFieldRange
Densitygrass.density0.1..1
Heightgrass.height0.3..2
Windwind.speed0..2
Gustswind.gust0..1.5
Wind dirwind.direction0..360°
Seasongrass.season0..1
Clumpinggrass.clumping0..1
Glowgrass.translucency0..2
Sheengrass.specular0..2

Time is demo-only. It moves the demo's sun and sky, and the grass follows through bindLights().