Skip to content
Projekte

Über uns

GPU-driven real-time FFT ocean (Three.js + WebGPU/TSL)

Design und Medien

So werden diese Zahlen gemessen

Gemessener Sternzuwachs

in 24h
0
in 7 days
0
in 15 days
+1
in 1 month
Verlauf wird gesammelt

Nettoänderungen in überlappenden Zeiträumen, keine Tagessummen. Fehlende Messwerte bleiben leer. Sterne zeigen Interesse, nicht Qualität.

README.md

Original

Poseidon

A real-time Tessendorf ocean in Three.js: three cascades of inverse FFT running as WebGPU compute shaders, shaded with measured water optics.

WebGPU three.js license

Golden-hour sea from just above the water, a crest breaking mid-frame

Run

npm install
npm run dev

Open the printed URL. WebGPU only, with no WebGL fallback: Chrome/Edge 113+ or Safari 18+. If the page reports WebGPU as unavailable on a machine that should have it, chrome://flags/#enable-unsafe-webgpu is the usual culprit.

npm run build / npm run preview produce and serve a static bundle.

Controls

The camera is an Unreal-style free look.

Input Action
Hold right mouse Look around
W A S D Fly along the view direction
Q / E Down / up (world space)
Shift 4× boost
Mouse wheel Fly speed
+ / − Choppiness λ

The panel on the right tunes sea state (wind speed and direction, amplitude, directionality, time scale), foam, surface detail and subsurface strength, and the sun. The chips in the bottom-left switch sea palette (tropical green ↔ open-ocean blue) and sky rig (midday ↔ golden hour) live.

The look

Sun glitter path at golden hour
Sun glitter. GGX with a knee, over a sun reconstructed from the panorama's clipped disc.
A solid white cap along a crest at golden hour
Whitecaps. Foam where the displacement Jacobian folds, with build/decay so caps linger and streak downwind.
A crest lit from behind, glowing green
Subsurface scatter. A thin lip goes warm, a thick one jade, off one exponential over a refracted path.
The wave field seen from 90 m up
Wave field. Three cascades on disjoint wavenumber bands: swell and ripple without visible tiling.
Open-ocean blue palette
Open-ocean blue. Jerlov absorption and scattering, not a tinted swatch.
Tropical green palette
Tropical green. Same water model, different inherent optical properties.

What's in it

Simulation

  • Stockham butterfly IFFT on the GPU, with precomputed twiddle/index buffers
  • 3 wave cascades (1024 / 144 / 24 m patches) on disjoint wavenumber bands
  • JONSWAP/Horvath directional spectrum: wind sea + swell, TMA depth correction, Donelan–Banner spreading
  • Wavenumber-weighted choppy displacement: full strength on the swell, rolled off on the chop, so crests get sculpted without pinching the ripples
  • Foam from the displacement Jacobian, accumulated with build/decay, its coverage targeted at the Monahan & O'Muircheartaigh whitecap fraction for the current wind speed

Shading

  • Exact dielectric Fresnel (n = 1.34) both ways across the interface, so a submerged camera gets a real Snell's window (the whole sky inside a 48.3° cone) with total internal reflection outside it
  • Subsurface scatter built from the three factors it actually has: entry Fresnel on the wave's far face, a Henyey–Greenstein forward lobe for the exit, and diffusion transmittance over a refracted path
  • Sun glitter (GGX with a knee) and self-composited aerial perspective
  • Two sky rigs, each carrying its own measured sun colour, intensity, and haze extinction
  • ~790k-vertex radial grid recentred on the camera: dense underfoot, sparse at 20 km, so the water runs to a real horizon

Credits

Spectrum and FFT techniques adapted from gasgiant/FFT-Ocean (MIT), based on Tessendorf 2001 (Simulating Ocean Water) and Horvath 2015 (Empirical Directional Wave Spectra for Computer Graphics).

Water optics (src/ocean/water.js) use the Jerlov coastal-water inherent optical properties tabulated by Solonenko & Mobley 2015, Inherent optical properties of Jerlov water types, Appl. Opt. 54(17):5392.

The golden-hour sky panorama (public/sky/sky_131_2k.png) is Skybox 131 by FreeStylized, used under their custom CC0 license rather than this project's.

Ähnliche Projekte entdecken

Wird geladen…