A real-time tropical island and ocean for the browser, written directly on WebGPU and WGSL with its own small rendering engine. 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 the boat, take or leave the helm, step ashore, trade with the fish buyer or the chandlery |
| V | Boat camera at the helm (1st / 3rd person) |
| R | Take out / put away the fishing rod |
| Left mouse | Hold to wind up, release to cast · strike when a fish takes the bait · hold to reel |
| Right mouse | Reel an empty line in |
| I or Tab | Cooler / fish hold and the fish log |
| F | Free camera |
| L | Flashlight |
| T | Pause time |
| M | Mute |
| H | Settings panel |
| P | Photo mode |
| F1 or ? | All controls |
Walk the deck of the boat while it drifts, or fish from the pier and the beach. Cast, wait for the bobber to dip and strike when it's pulled under, then play the fish: keep the line tension in the green band, ease off when it runs. Different water holds different fish (the shallows, the pier, the reef, the bay and deep water offshore), and some bite best at dawn, dusk or night. Sell your catch to Joe at the fish stand on the beach by the pier, and spend it at Marta's chandlery by the boathouse: stronger line, a faster reel, a longer rod, a bigger fish hold, a larger fuel tank, a rebuilt engine, a fish finder and deck floodlights for night fishing. The boat burns diesel at the helm; fill up at the chandlery. Progress is saved in the browser.
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/engine/ |
The rendering engine: math, scene graph and geometry, GPU resources, WGSL shader composition, materials, lighting and shadows |
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 |
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.