NatureGL Riverv1.0.0

Reference

Presets

Nine looks, one file each, in src/config/presets/. Every preset sets both the water and the light. Hover a card to see the water move, click to enlarge it, or run one live.

ClearclearClear mountain stream at noon: turquoise over pebbles, strong caustics.
MorningmorningLow warm sun from the east over the same clear water.
Golden hourgoldenLong light and warm glints on the ripples.
OvercastovercastFlat, soft light under a greyer sky.
Glacial meltglacialMilky turquoise rock-flour water, faster and foamier.
Muddy spatemuddyBrown, opaque and fast, with heavy foam and almost no caustics.
SwampswampTannin-dark, slow, glassy water under a greenish haze.
DuskduskSun under the ridge, a purple sky and the first stars.
NightnightMoonlit: stars, dim moon glints and dark water.

#Loading presets

js
water.loadPreset('glacial');                   // lighting eases over ~1.5 s, water over ~0.3 s
water.loadPreset('glacial', { instant: true }); // snap
water.loadPreset(myPresetObject);              // any object in the preset format

create({ preset }) takes a name or an object too. Unlike some other packs in the series, a preset object must be complete: it replaces params rather than being merged into it. Start from getPresetParams() when you only want to change a few values.

js
import { PRESETS, getPresetParams } from 'naturegl-river';

Object.keys(PRESETS);             // ['clear', 'morning', 'golden', …]
const p = getPresetParams('clear'); // deep clone, safe to edit
p.water.clarity = 1.8;
p.light.elevation = 30;
water.loadPreset(p);

#Presets are plain data

src/config/presets/glacial.js
/** Glacial melt — milky turquoise rock flour */
export default {
  name: 'glacial',
  label: 'Glacial melt — milky turquoise rock flour',
  water: {
    absorption: [0.55, 0.12, 0.09], scatterColor: [0.05, 0.3, 0.32], scatterDensity: 0.95,
    clarity: 0.9, flow: 1.35, caustics: 0.45, foam: 1.25, turbulence: 1.3,
    normalStrength: 1.1, refraction: 0.8, reflectivity: 1.0, wetness: 1.0,
    horizonHeight: 0.24,
  },
  light: {
    elevation: 34, azimuth: 24, sunColor: '#f2f6ff', sunIntensity: 2.7,
    skyTop: '#6f98c8', skyHorizon: '#d4e2ea', fogColor: '#c6d6df', fogDensity: 0.0072,
    hemiSky: '#d2e2ff', hemiGround: '#46514a', hemiIntensity: 1.2,
    horizonColor: '#1f2c26', lightAmount: 1.0, exposure: 1.0, clouds: 0.6, stars: 0,
  },
};

Every field is described on Preset parameters.

#Try one live

Runs WebGL2 in this page · starts on glacial
Starts on glacial. Click the preset pills in the demo to switch.

#Reference

The first four and the last two share the clear water of clear and change only the light.

NameLabelClarityFlowCausticsFoamSun
clearClear Stream — noon1.11.01.01.055°, 3.2
morningClear Stream — morning1.11.01.01.017°, 2.6
goldenClear Stream — golden hour1.11.01.01.07°, 2.3
overcastClear Stream — overcast1.11.01.01.042°, 0.8
glacialGlacial melt — milky turquoise rock flour0.91.350.451.2534°, 2.7
muddyMuddy spate — brown, fast and opaque0.81.60.121.538°, 2.5
swampSwamp / still lake — tannin-dark, slow0.90.250.350.328°, 2.0
duskDusk — sun just under the ridge1.11.01.01.02.5°, 1.5
nightNight — moonlit stream1.11.01.01.038°, 0.45

The sun column is elevation and sunIntensity. At night the "sun" is the moon: a blue-white light at 0.45 with stars: 1 and lightAmount: 0.16.