Overview
Convincing water is mostly about reflections, distortion and specular highlights rather than fluid simulation. Three.js includes a production-ready Water object that combines all three. This demo places it around a lit island, animates the waves and exposes the distortion and colour controls, using a generated normal texture so it needs no external assets.
How it works
The Water object from three/examples/jsm/objects/Water.js is a large plane with a specialised shader:
- Planar reflection. Before the main render, the scene is drawn from a mirrored camera below the water plane into a render target, capturing what the surface should reflect.
- Normal-map ripples. A tiling normal map is sampled twice at different scales and scrolling directions, and the combined normal distorts the reflection lookup, so the reflection wobbles like real water.
distortionScalesets how strong that wobble is. - Fresnel and sun glint. At glancing angles water reflects more, and looking straight down it shows more of its own colour. A specular term based on the sun direction creates the bright glints that sell the effect.
Animating is as simple as increasing water.material.uniforms.time each frame. Here the normal map is generated as a DataTexture from code, so the demo does not fetch an image.
Exploring the demo
Increase distortion to turn calm, glassy water into choppy water, and lower it for a mirror-like lake. Orbit to a low angle and notice the reflections strengthen (the Fresnel effect), then look down from above to see more of the water colour. Move around to catch the sun glints.
Practical advice
Planar reflections cost a second render of the scene, so keep the reflection render target modest and hide small objects from the reflection where you can. For a stylised or cheaper look, see the water shader and caustics; for scenes built around water, see the oasis and the underwater scene.