What it does
The waves come from three cascades of the JONSWAP ocean spectrum, each owning one band of wavelengths, evolved every frame through an FFT into displacement and normal textures. A geometry clipmap follows the camera and samples them from coarse to fine, so small ripples ride on the long swell, and an outer ring carries the sea to the camera's far plane.
The surface is shaded from the physics up. Light that enters the water is absorbed colour by colour through the column of scene beneath it, either from colours you choose or from a physical model of the water's algae, silt and stain. It reflects the sky's environment map and, through screen-space reflections, the boats and cliffs above it. It glows where the sun is behind a crest, sparkles in the sun's path, and carries three layers of foam, one of them a lasting field fixed to the world that breaking crests feed and the wind streaks out. Beneath the surface, the underwater pass refracts, fogs through the same colour model and adds sun shafts.
Boats are part of it. float sets a hull's height, pitch and roll from heights the GPU samples, and its motion drives
a wake field with its own foam. mask cuts the water out of a hull so the deck stays dry, and spray throws bursts
from the bow where it strikes the surface fast. A sand-and-rock floor below catches the caustics, and rain falls as
streaks that leave rings on the water.
Features
- An FFT ocean — three wave cascades evolved on the GPU, with a seed for repeatable seas.
- Ripples on the swell — a camera-following clipmap that samples every cascade and reaches the horizon.
- Physically based colour — per-channel absorption with custom colours, or a
physicalmode driven byalgae,siltandstain. - Reflections — the sky's environment map, plus screen-space reflections of the geometry above the water.
- Lasting foam — three foam layers, one a world-fixed field that breaking crests feed and the wind streaks.
- Floating boats —
floatgives height, pitch, roll and a wake, andprobekeeps a sampled height and normal at any point. - Dry decks and bow spray —
maskkeeps the water out of a hull, andspraythrows flipbook bursts at the bow. - An ocean floor with caustics — a sand-and-rock plane at a set depth, with caustics published for the seabed.
- Rain — falling streaks and the ripple rings they leave.
- Its own underwater view — refraction, fog and sun shafts when the camera goes below, and
submergedto tell you it has. - Presets and quality tiers —
sunset,tropicalandstorm, andlow,medium,highorultra.
Good for
- Ship and naval games — where the sea is a character rather than a floor, and the boats ride it.
- Sailing and boat simulations — hulls that pitch and roll on the swell, leave wakes and throw spray.
- Island and coastal showpieces — a sunset or tropical sea against a shore built with terrain.
- Storm sequences — the storm preset, rain on, high wind and spray off every bow.
- Diving games — the camera crosses the surface into a refracting, fogged sea with sun shafts.
- Title screens and cinematic sea views — the water as the scene's centrepiece on WebGPU hardware.
Make it yours
game.watermax.params holds every setting in groups, waves, color, foam, fresnel, sss, sparkle, ssr,
caustics, fog, underwater, wake, clipmap, floor, rain and spray, and apply merges a partial patch
into them live. A preset is the starting point, and quality trades cascades, mesh density, foam and wake field sizes
and screen-space reflections for speed. The pack's options set the preset, quality, water level, seed, caustics and
underwater pass, and the foam, floor and spray textures, which are bundled files by default and can be your own.
Two very different seas: a calm tropical lagoon at high quality, the physical colour model tuned for clear water, caustics on the floor and a camera that dives below; and a storm at medium quality with the wind raised, rain falling and every boat floated, masked and throwing spray.
A quick look
A boat floated, kept dry and throwing spray, on a windier, siltier sea with rain:
const boat = game.world3d.spawn({ mesh: 'wedge', x: 0, y: 0, z: 0, sx: 4, sy: 2, sz: 10 });
game.watermax.float(boat, { length: 10, width: 4, offset: -0.5 });
game.watermax.mask(boat);
game.watermax.spray(boat, { params: { size: 10, opacity: 0.4 } });
game.watermax.apply({ waves: { windSpeed: 6 }, color: { mode: 'physical', algae: 0.1, silt: 0.3, stain: 0.03 }, rain: { enabled: true } });
Works with
skymax— the environment map it reflects and the sun it takes; it also works undersky-3d, or with no sky at all against a fallback gradient.world-3dandrender-3d— required; it draws into the renderer's target and reads its depth and lighting.terrain-3d— where the seabed should rise to a shore, since the built-in floor is flat.water-3d— the alternative: cheaper Gerstner water with lakes and streams on WebGPU and WebGL2. Compose one or the other.
Good to know
- WebGPU only, with no WebGL fallback, and far heavier than
water-3d. - Heights are read back from the GPU a frame or two late, so a floated hull is smoothed rather than exact; a game
whose rules read the water's height every step wants
water-3d. - Screen-space reflections can only reflect what is on screen, and the floor is a flat plane at one depth.
- It brings its own caustics and underwater pass, so composing it with
water-3dorunderwater-3dthrows an error naming both packs. - The sea's outer ring reaches the camera's far plane, so too small a far plane leaves the edge of the water visible.






