A real-time tropical island and ocean for the browser, built with three.js, WebGPU and TSL (three.js' shader language). Walk the beach, swim the reef, drive the boat, and watch a humpback breach.
Live demo: https://dgreenheck.github.io/tidewater/
- A browser with WebGPU: a recent Chrome, Edge or Safari.
- A capable GPU. It targets 60 fps at 2560×1267 on an Apple M5 Pro, and dynamic resolution scales the render down on slower machines.
- The first load compiles several hundred shaders, which can take a minute or more. Later visits are faster because the browser caches them.
Ocean
- Four-cascade FFT ocean (Tessendorf spectra) with foam, whitecaps, wind streaks and swell.
- Depth-aware breaking waves with peeling shoulders, whitewater, spray and foam lace.
- A shallow-water simulation for swash running up and down the sand.
- Boat wake and bow spray, and a whale wake.
- Caustics on the seabed and in the water, with light shafts.
- A split underwater/above-water view at the waterline, with water droplets on the lens after surfacing.
Sky
- Physically based atmosphere (Hillaire 2020) with a sun, moon and stars.
- Volumetric cumulus and wispy cirrus with cloud shadows on the land.
- Aerial perspective and sea haze.
- God rays, and a lens flare with occlusion.
World
- An island with a beach, hills, headlands and rocks.
- A fishing village and a pier.
- A coral reef with fish.
- Palms, broadleaf trees and shrubs with impostors and dithered LOD fades.
- Beach debris.
- Birds, crabs and marine snow.
- A humpback whale with an escort of fish, blows, fluke dives and breaches.
Lighting and post
- Cascaded shadows with contact-hardening penumbrae, and screen-space contact shadows.
- Ground bounce light.
- GTAO ambient occlusion.
- Temporal upscaling and sharpening.
- Bloom, auto exposure and motion blur.
- Night lighting from lanterns, windows and the boat, plus a flashlight that also works underwater.
Audio
- Positional audio from real CC0 field recordings: surf timed to each breaking wave, wind, birds, the boat engine, footsteps by surface, underwater ambience and whale song.
| Key | Action |
|---|---|
| W A S D | Move |
| Mouse | Look (click to capture the mouse, Esc to release) |
| Shift | Sprint / boat boost |
| Space | Jump / swim up |
| C | Crouch / dive |
| E | Interact, board or leave the boat |
| V | Boat camera (1st / 3rd person) |
| F | Free camera |
| L | Flashlight |
| T | Pause time |
| M | Mute |
| H | Settings panel |
| P | Photo mode |
| F1 or ? | All controls |
The settings panel (H) exposes the sea state, time of day, sun azimuth, clouds, haze, post-processing and more.
Add these to the URL, for example ?fly&noAudio:
| Option | Effect |
|---|---|
fly |
Start in the free camera |
noAudio |
Disable sound |
noClouds |
Skip the volumetric clouds |
noHaze |
Skip the haze and sun shafts |
noCaustics |
Skip caustics |
noVeg |
Skip vegetation |
noSim |
Skip the swash (shallow-water) simulation |
npm install
npm run dev # http://127.0.0.1:5188
npm run build # static build in dist/Every push to main deploys to GitHub Pages through .github/workflows/deploy.yml.
| Folder | Contents |
|---|---|
src/ocean/ |
FFT ocean, water surface and material, shore waves, breakers, swash, wake, caustics, underwater lighting |
src/sky/ |
Atmosphere, clouds, sky and environment |
src/world/ |
Terrain, village, pier, reef, fish, vegetation, rocks, debris, wildlife, whale, boat |
src/post/ |
Post chain: AO, underwater composite, haze, TAAU, motion blur, bloom, lens flare, droplets |
src/materials/ |
Shared lighting: shadow filtering, bounce light, contact shadows, local lights, LOD fades |
src/player/ |
Walking, swimming, the boat and the free camera |
src/audio/ |
The sample-based soundscape |
src/ui/ |
Settings panel and HUD |
authoring/whale/ |
Scripts that generate the humpback model and textures |
The code is released under the MIT license; see LICENSE. Third-party assets (CC0 audio from Freesound, CC0 scans from Poly Haven) and technique references are listed in CREDITS.md.