Water material
<WaterMaterial> is the material of the mesh it sits in, inside a Landscape. It draws the mesh as water: a lake, a river or a sea. Two layers of noise drift across each other as ripples, and waveHeight lifts the surface itself into waves. The water turns toward its shallow colour near its edge and breaks into foam at the shore. facetSize breaks the surface into flat tilting triangles, each of its own tint, for a low-poly look. The ripples run on the effects’ clock, as a map’s sea and its grass do: the devtools’ pause and a pausing modal hold them, and the devtools’ speed leaves them at the wall clock’s pace, so a pond keeps the sea’s pace at 2x. A devtools step does not move them. A water you write on Shader runs on the world’s clock instead.
Its props are in WaterMaterialProps. For a pixel-art game, the pixel water material draws water on the texture grid instead.
The shore is the edge of the plane’s texture coordinates: the square, or the circle inside it when round is on. Draw the water on a planeGeometry, because another mesh’s edge does not follow that square, and part of its rim would have no foam. Lay the plane flat where the water should be, a little above the ground, and size it to the lake or the river. The ripples and the waves keep the same size on any plane, because they follow the ground rather than the plane’s corners.
The water is three’s standard material with its colour, roughness and normal spliced in, so the scene’s sun, fill, shadows, fog, exposure and tone mapping fall on it as on the ground. It reflects 2 % of the light that meets it head on, as water does, where three’s standard material reflects a glass’s 4 %, which greys a deep colour under a strong sun. It reflects the look’s sky image where a look sets one, and otherwise the fill light’s sky colour. It draws in one pass, without a depth texture or a second render of the scene, so a phone can afford it: trees and the sun do not mirror in it.
directSpecularIntensity scales the highlight the sun and the other lights draw on the water, from 0 to 1, the physically based one by default. Lower it to calm a low sun’s glare on rough water. Sky reflection is unchanged. Unreal’s materials and Godot’s scale their highlight by a specular value of 0.5 by default.
sparkleIntensity draws glints where the sun or the moon mirrors in the water: twinkling four-pointed stars in a band toward the light, each its light’s colour. It is 0, off, by default, and 1 is the reference, near white under a day’s sun. The glints add after directSpecularIntensity, which scales the ordinary highlight alone. sparkleSize is the metres between them, 0.5 by default, one star a cell, the star growing with it. A star draws only where its cell spans at least two pixels, so a far camera wants a larger size, such as Juice Island’s lobby, which sets about 0.6 % of its camera’s distance held upright. With the light far from the view’s mirror, no glint shows.
Two angles shape the band. sparkleSpreadRadians, 0.16 by default, is the most each glint’s facet leans from straight up. sparkleConeHalfAngleRadians, about 0.127 by default, is how far a glint’s mirror may point from the light and still flash, fading to nothing at that edge. A smaller cone makes each flash more selective: fewer glints show, and they gather toward the light’s mirror. The band reaches about the cone and twice the spread either side of the mirror, and the view’s angle then stretches it across the water. The cone takes 0.001 or more, since a smaller angle’s cosine reads 1 in the shader; sparkleIntensity 0 turns the glints off.
sparkleGlowIntensity lays a soft glow round each star in sparkleGlowColor, white by default. The glow has four rays that reach further as the flash peaks, and by default it stays inside its cell. It takes the water’s own colour’s place under it, as a painted glint covers the sea, so a gold glow reads gold over a deep blue that added light would grey. The sea’s highlight, its sky and, in clear water, the bed still show through it, and foam keeps its colour. It scales with sparkleIntensity and the light’s strength, so it dims under the moon. Past the point where it covers the water, a larger value draws no brighter.
sparkleGlowScale widens each glow as a multiple of its own size, from 1, the default, to 3. At 1 the glow fades out inside its star’s cell; at 2 it reaches the middles of the next cells. So a strip of small cells draws many stars as large as fewer big ones, which a denser strip needs, since smaller cells alone draw smaller stars. Where two glows overlap, the brighter covers, so a dense strip stays separate stars rather than a haze. The stars themselves keep their cells, and every star stands at its cell’s middle. The glints still fade by their own cell’s pixels, so smaller cells fade nearer the camera.
Above 1, each pixel inside the glints’ band reads the stars of the cells round it: up to 2, the three nearest; above 2, all eight. A change across 1 or 2 compiles the water’s shader anew. On Juice Island’s lobby at Low, 393 by 852, with the hour pinned at 15:00 and the cells at 0.6 % of the camera’s distance, the GPU took 1.62 and 1.63 ms a frame at the median before the option. It took 1.63 and 1.64 ms at a scale of 1, 1.81 and 1.82 ms at 2, and 1.91 and 1.92 ms at 3. That was on an M2 Pro, two runs each in flipped order (spawnite play profile --dev --no-vsync --gpu, 2026-10-20). A phone was not measured.
The glow’s colour is its own, not the light’s, so a gold glow stays gold under a warm sun, and a white glow round a red light’s star stays white. Unity’s, Unreal’s and PlayCanvas’s bloom, Godot’s glow and Roblox’s BloomEffect glow round a bright glint as a post effect over the whole frame. Here the water draws the glow in its own pass, so it shows at Low, which draws no bloom.
At a sparkleGlowScale of 1 the glow costs nothing measurable. Juice Island’s lobby at Low, 393 by 852, took 1.61 ms of GPU a frame at the median in both runs with the glow at 0.6, and 1.71 and 1.62 ms with it off. That was on an M2 Pro at 70 to 91 % CPU load from other sessions (spawnite play profile --dev --no-vsync --gpu, 2026-10-20). A phone was not measured.
The cone costs nothing measurable: Juice Island’s lobby at Low, 393 by 852, took 1.61 ms of GPU a frame at the median in two runs at 0.04, and 1.60 and 1.61 ms at the default, on an M2 Pro (spawnite play profile --dev --no-vsync --gpu, 2026-10-20).
The glints take no shadow: a glint in a tree’s shadow, under a cloud shadow or in a light mask’s dark still flashes. Unity HDRP’s water and Crest shape the sun’s highlight with a smoothness, Unreal’s Single Layer Water and Godot’s material with a roughness, and PlayCanvas’s water and three’s Water with a specular power. None of their documented controls draws a separate star or names a cone. These draw the star themselves, so it shows at Low, which draws no bloom. It was measured on Juice Island’s lobby at Low, 393 by 852, on an M2 Pro under 82 to 100 % CPU load from other sessions on 2026-10-19. Two runs each took 1.60 and 1.94 ms of GPU a frame with the glints and 1.56 and 1.53 ms without, at the median: no cost shows above the noise. A phone was not measured.
Roblox makes water a terrain material, with wave size and speed set on the terrain. Unity’s HD pipeline ships a water system, and Godot leaves water to community shaders. Three’s own Water draws the scene a second time for its reflection, which costs a phone a frame’s worth of work. Here water is a material with props, as the CRT material is, and a map’s sea lays the same water across the whole map, its shallows and foam where the ground under each point rises to the surface rather than at the plane’s edge. Its ripples run on the effects’ clock rather than the world’s, as Godot’s shader TIME runs unscaled while Unity’s _Time follows timeScale: they are the map’s ambient motion, so they keep the grass’s pace whatever the devtools’ speed.
Waves that move the surface
Section titled “Waves that move the surface”waveHeight sets the metres from trough to crest of a typical wave, as a sea’s significant height reads, and lifts the surface by four sine waves. The water rises and falls against its shore, a pile or a hull, and the light rolls over each wave, a crest lighter and a trough darker. The depth, the shallows, the foam and the clear water follow the moved surface, so a wave runs up the sand. The rare highest crest, where all four meet, stands about 1.35 times the height over its trough. A pond’s default is 0, which compiles none of it, and a sea’s is 0.25 m.
waveLength sets the metres crest to crest of the longest wave, 12 by default, and the other three run shorter, the shortest at about half. waveDirectionRadians sets where they run, turned from +z toward +x as the look’s wind reads. waveSpeed runs them as a share of deep water’s pace for their length, 1 by default, so a longer wave runs faster, as at sea. rippleSize and rippleSpeed set the ripples apart from them. A change to waveLength, waveDirectionRadians or waveSpeed while the world runs moves every wave to where the new values put it at that moment, so the surface jumps once; a change to waveHeight scales it smoothly.
The mesh needs vertices to move. Give a planeGeometry segments about a metre apart, such as args={[8, 8, 8, 8]}: a plane of one segment lifts and tilts its four corners as one. The waves lift along the world’s up, so they suit flat water. They run on the world’s clock, unlike the ripples, as a map’s sea’s do so a system can read them: the devtools’ pause holds them and its speed runs them faster. A pond’s waves have no read for a system; a sea’s have findSeaHeight.
Unity HDRP’s Ocean raises its swell from a wind speed over a repeating patch, and its Pool has ripples alone. Unreal’s water sums 16 Gerstner waves between a least and a greatest wavelength and amplitude, round a wind angle. PlayCanvas’s water script takes a swell amplitude and length, off by default, and Roblox’s terrain takes a wave size, its height. Here the waves only rise and fall, as The Wind Waker’s four cosines do, so a point’s height reads in one pass, on the room as on the page.
A pond in a map
Section titled “A pond in a map”A water plane laid on a map’s ground draws over the ground, and the map’s trees, grass, tufts, bushes and rocks keep growing through it. Clear the ground under the pond with two brushes of the map editor: the MCP’s edit_terrain, spawnite map terrain, or the devtools’ Terrain section. Give each the pond’s centre and a radius a metre past its edge, since a brush weakens toward its rim, and a strength of 1:
scatterwithmultiplier: 0over the familiestree,tuft,bushandrock. Thetuftmultiplier thins the grass blades as well as the tufts. A tree that stands just past the radius can still hang its canopy over the water: widen the brush fortreealone, orerasethat one tree.eraseis also for the single instances left standing once the multiplier is 0.paintwith a material that grows no grass, such assand, for a shore.
map_query at the pond then reads its grass as bare, and both edits live in the map’s file, src/maps/<map>.json.
Sample
Section titled “Sample”A round pond in the meadow:
import { Entity, Views, WaterMaterial, Landscape } from "@spawnite/engine";
export function Pond() { return ( <Landscape map="meadow"> <Entity position={[0, 0.05, -4]}> <Views> <mesh rotation={[-Math.PI / 2, 0, 0]}> <planeGeometry args={[6, 6]} /> <WaterMaterial round rippleSize={1.5} /> </mesh> </Views> </Entity> </Landscape> );}Where it runs
Section titled “Where it runs”Client. The water changes nothing in the world; each player’s browser draws its own. A player walks over it as over the ground: it has no collider, and no swimming.