JONSWAP Wave Spectrum
An empirical wave energy spectrum for wind seas that are still growing, with a sharp peak at the dominant frequency, used to seed the amplitudes of an FFT ocean.
Also known as JONSWAP, Joint North Sea Wave Project spectrum
In the family Atmosphere, water & volumes, ocean
Where it runs
Built inOfficial add-onPluginNone foundNot researched
| Engine | Support | How |
|---|---|---|
| three.js r187 | None found | |
| Babylon.js 9.38.0 | None found | |
| Godot 4.7 | None found | |
| Unity | None found | HDRP water uses a Phillips spectrum, not JONSWAP. |
| Unreal 5.7 | None found | |
| Blender 5.2 | Built in | Ocean modifier > Spectrum = Established Ocean (Sharp Peaks) or Shallow Water docs |
| WebGPU W3C | None found | |
| Metal | None found |
How it works
The JONSWAP spectrum is the Pierson-Moskowitz fully developed sea spectrum multiplied by a peak enhancement factor gamma raised to an exponent that depends on how close the frequency is to the peak. Its inputs are wind speed, fetch (the distance of open water the wind has blown over) and optionally peak frequency; from these you derive the peak frequency and the Phillips-like alpha constant. The result gives energy per frequency. For graphics you convert it into a function of the wave vector, multiply by a directional spreading function such as cosine to a power around the wind direction (frequency-dependent in more accurate versions), and divide by the Jacobian of the dispersion relation to get energy per unit area in k-space. The square root of that is the standard deviation used to draw each random Fourier amplitude. A short-wave cutoff and a damping factor for waves moving against the wind are usually added.
When to choose it
Reach for it when
- ocean waves look unrealistic or too regular
- need sea state driven by wind speed and fetch
- fft ocean wave heights need a believable spectrum
- wave patterns for open sea versus calm lake
Choose it when an FFT ocean must respond to physically meaningful inputs (wind speed, fetch) and show a narrow dominant swell rather than the broad, scale-free look of the Phillips spectrum.
Prefer the Phillips spectrum for the simplest, widely documented setup in FFT Ocean (Tessendorf). Prefer hand-picked amplitudes in Gerstner (Trochoidal) Waves if you just need a few art-directed swells.
Field marks
- Wrong units for fetch or wind speed give implausibly tall or flat seas
- Using a non-directional spectrum yields waves travelling in all directions
- Missing short-wave cutoff produces noisy capillary-scale aliasing on the grid
- Single wind-driven spectrum ignores swell from distant storms
- Peak enhancement gamma set too large produces an unnaturally regular, almost monochromatic sea
Presets
Ocean waves synthesized from a JONSWAP spectrum (sum-of-cosines toy, not FFT)
{
"N_WAVES": 28,
"PEAK_W": 1.1,
"ALPHA": 0.0081,
"GAMMA": 3.3
}Show GLSL (63 lines)
// Ocean surface synthesized from a JONSWAP frequency spectrum: each wave component has
// amplitude sqrt(2 S(w) dw), wavenumber k = w^2/g (deep-water dispersion), random phase and direction.
const int N_WAVES = 28;
const float GRAV = 9.81;
const float PEAK_W = 1.1;
const float ALPHA = 0.0081;
const float GAMMA = 3.3;
float hash(float n) { return fract(sin(n * 127.1) * 43758.5453); }
float jonswap(float w) {
float sg = w <= PEAK_W ? 0.07 : 0.09;
float r = exp(-(w - PEAK_W) * (w - PEAK_W) / (2.0 * sg * sg * PEAK_W * PEAK_W));
return ALPHA * GRAV * GRAV / pow(w, 5.0) * exp(-1.25 * pow(PEAK_W / w, 4.0)) * pow(GAMMA, r);
}
float height(vec2 p, float t) {
float h = 0.0; float dw = 2.6 / float(N_WAVES);
for (int i = 0; i < N_WAVES; i++) {
float fi = float(i);
float w = 0.6 + (fi + hash(fi)) * dw;
float a = sqrt(2.0 * jonswap(w) * dw);
float k = w * w / GRAV;
float th = (hash(fi * 3.7 + 1.0) - 0.5) * 2.2;
h += a * cos(k * dot(vec2(cos(th), sin(th)), p) - w * t + 6.2832 * hash(fi * 7.3 + 2.0));
}
return h;
}
vec3 sky(vec3 d) {
vec3 sd = normalize(vec3(0.3, 0.25, -1.0));
vec3 c = mix(vec3(0.8, 0.85, 0.9), vec3(0.2, 0.4, 0.75), pow(clamp(d.y, 0.0, 1.0), 0.45));
return c + vec3(1.0, 0.85, 0.6) * pow(max(dot(d, sd), 0.0), 200.0) * 6.0;
}
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
vec3 ro = vec3(0.0, 4.0, 0.0);
vec3 rd = normalize(vec3(uv.x, uv.y - 0.1, -1.0));
vec3 col = sky(rd);
if (rd.y < -0.002) {
float t = (ro.y - 2.5) / -rd.y; float dt = 0.4; float tp = t;
bool hit = false;
for (int i = 0; i < 90; i++) {
vec3 p = ro + rd * t;
if (p.y < height(p.xz, iTime)) { hit = true; break; }
tp = t; dt = max(0.4, t * 0.05); t += dt;
}
if (hit) {
float a = tp, b = t;
for (int i = 0; i < 6; i++) {
float m = 0.5 * (a + b); vec3 p = ro + rd * m;
if (p.y < height(p.xz, iTime)) b = m; else a = m;
}
t = b; vec3 p = ro + rd * t; float e = 0.05 + 0.01 * t;
float h0 = height(p.xz, iTime);
vec3 n = normalize(vec3(h0 - height(p.xz + vec2(e, 0.0), iTime), e, h0 - height(p.xz + vec2(0.0, e), iTime)));
float f = 0.02 + 0.98 * pow(1.0 - max(dot(n, -rd), 0.0), 5.0);
vec3 water = vec3(0.01, 0.07, 0.1) + vec3(0.04, 0.12, 0.1) * clamp(p.y * 0.5 + 0.5, 0.0, 1.0);
col = mix(water, sky(reflect(rd, n)), f);
col = mix(col, sky(vec3(rd.x, 0.02, rd.z)), 1.0 - exp(-t * 0.004));
}
}
col = 1.0 - exp(-col * 1.3);
fragColor = vec4(pow(col, vec3(1.0 / 2.2)), 1.0);
}
Attribution: written for this index
Measured GPU weight & timing
| Preset | GPU | Weight / p50 / p95 | Method |
|---|---|---|---|
| jonswap-spectrum-specimen | Tesla T4 1920x1080 | 75.4× baseline (extreme) · 2.48 ms / 2.57 ms | opengl-timer-query · 40 frames · GPU Weight Atlas · Colab T4 sweep |
| jonswap-spectrum-specimen | NVIDIA L4 1920x1080 | 56.8× baseline (heavy) · 0.903 ms / 0.924 ms · 2.8× faster on L4 | opengl-timer-query · Cross-architecture validation |
| jonswap-spectrum-specimen | NVIDIA A100-SXM4-40GB 1920x1080 | 47.6× baseline (heavy) · 1.37 ms / 1.38 ms · 1.8× faster on A100 | opengl-timer-query · Cross-architecture validation |
Lineage
Crosses
- FFT Ocean (Tessendorf): Supplies the initial h0(k) amplitudes whose time evolution the FFT then evaluates.
Sources
- primaryChristopher J. Horvath (2015). Empirical directional wave spectra for computer graphics. Proceedings of the 2015 Symposium on Digital Production.Verified via crossref · 2026-11-29doi:10.1145/2791261.2791267
- primaryJerry Tessendorf. Simulating Ocean Water. SIGGRAPH Course Notes 2001/2004.Verified via live page · 2026-11-29