{
 "id": "jonswap-spectrum",
 "title": "JONSWAP Wave Spectrum",
 "aliases": [
  "JONSWAP",
  "Joint North Sea Wave Project spectrum"
 ],
 "domain": "volumes",
 "subdomain": "ocean",
 "stage": "volume",
 "realtime": "realtime",
 "platforms": [
  "webgl2",
  "webgpu",
  "desktop-gpu",
  "cuda",
  "unity",
  "unreal",
  "houdini",
  "blender"
 ],
 "year_introduced": 1973,
 "inputs": [
  "material-params"
 ],
 "outputs": [
  "texture"
 ],
 "style": "photoreal",
 "dynamic": "dynamic",
 "summary": "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.",
 "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_use": "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.\n\nPrefer the Phillips spectrum for the simplest, widely documented setup in `fft-ocean`. Prefer hand-picked amplitudes in `gerstner-waves` if you just need a few art-directed swells.",
 "cost": {
  "class": "cheap",
  "notes": "Evaluated once per grid cell when (re)generating the initial spectrum texture, not every frame."
 },
 "failure_modes": [
  "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"
 ],
 "sources": [
  {
   "role": "primary",
   "key": "doi:10.1145/2791261.2791267",
   "type": "paper",
   "title": "Empirical directional wave spectra for computer graphics",
   "authors": [
    "Christopher J. Horvath"
   ],
   "year": 2015,
   "venue": "Proceedings of the 2015 Symposium on Digital Production",
   "url": "https://doi.org/10.1145/2791261.2791267",
   "ids": {
    "doi": "10.1145/2791261.2791267"
   },
   "license": null,
   "extra": {
    "csl_type": "proceedings-article"
   },
   "provenance": {
    "title": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/2791261.2791267",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/2791261.2791267",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/2791261.2791267",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/2791261.2791267",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/2791261.2791267",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 1,
   "__bib": "horvath2015empirical"
  },
  {
   "role": "primary",
   "key": "url:https://people.computing.clemson.edu/~jtessen/reports/papers_files/coursenotes2004.pdf",
   "type": "web",
   "title": "Simulating Ocean Water",
   "authors": [
    "Jerry Tessendorf"
   ],
   "year": null,
   "venue": "SIGGRAPH Course Notes 2001/2004",
   "url": "https://jtessen.people.clemson.edu/reports/papers_files/coursenotes2004.pdf",
   "ids": {},
   "license": null,
   "extra": {
    "http_status": 200,
    "live": true,
    "archive": {
     "url": "http://web.archive.org/web/20261021155515/https://jtessen.people.clemson.edu/reports/papers_files/coursenotes2004.pdf",
     "timestamp": "20261021155515"
    },
    "page_title": null,
    "host": "jtessen.people.clemson.edu",
    "title_confirmed_by_page": false,
    "title_unconfirmed": false
   },
   "provenance": {
    "title": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "http",
     "endpoint": "GET https://people.computing.clemson.edu/~jtessen/reports/papers_files/coursenotes2004.pdf → 200",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": null,
   "__bib": "tessendorfsimulating"
  }
 ],
 "presets": [
  {
   "id": "jonswap-spectrum-specimen",
   "title": "Ocean waves synthesized from a JONSWAP spectrum (sum-of-cosines toy, not FFT)",
   "runtime": "glsl-fragment",
   "params": {
    "N_WAVES": 28,
    "PEAK_W": 1.1,
    "ALPHA": 0.0081,
    "GAMMA": 3.3
   },
   "code": "// Ocean surface synthesized from a JONSWAP frequency spectrum: each wave component has\n// amplitude sqrt(2 S(w) dw), wavenumber k = w^2/g (deep-water dispersion), random phase and direction.\nconst int N_WAVES = 28;\nconst float GRAV = 9.81;\nconst float PEAK_W = 1.1;\nconst float ALPHA = 0.0081;\nconst float GAMMA = 3.3;\n\nfloat hash(float n) { return fract(sin(n * 127.1) * 43758.5453); }\nfloat jonswap(float w) {\n  float sg = w <= PEAK_W ? 0.07 : 0.09;\n  float r = exp(-(w - PEAK_W) * (w - PEAK_W) / (2.0 * sg * sg * PEAK_W * PEAK_W));\n  return ALPHA * GRAV * GRAV / pow(w, 5.0) * exp(-1.25 * pow(PEAK_W / w, 4.0)) * pow(GAMMA, r);\n}\nfloat height(vec2 p, float t) {\n  float h = 0.0; float dw = 2.6 / float(N_WAVES);\n  for (int i = 0; i < N_WAVES; i++) {\n    float fi = float(i);\n    float w = 0.6 + (fi + hash(fi)) * dw;\n    float a = sqrt(2.0 * jonswap(w) * dw);\n    float k = w * w / GRAV;\n    float th = (hash(fi * 3.7 + 1.0) - 0.5) * 2.2;\n    h += a * cos(k * dot(vec2(cos(th), sin(th)), p) - w * t + 6.2832 * hash(fi * 7.3 + 2.0));\n  }\n  return h;\n}\nvec3 sky(vec3 d) {\n  vec3 sd = normalize(vec3(0.3, 0.25, -1.0));\n  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));\n  return c + vec3(1.0, 0.85, 0.6) * pow(max(dot(d, sd), 0.0), 200.0) * 6.0;\n}\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) {\n  vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;\n  vec3 ro = vec3(0.0, 4.0, 0.0);\n  vec3 rd = normalize(vec3(uv.x, uv.y - 0.1, -1.0));\n  vec3 col = sky(rd);\n  if (rd.y < -0.002) {\n    float t = (ro.y - 2.5) / -rd.y; float dt = 0.4; float tp = t;\n    bool hit = false;\n    for (int i = 0; i < 90; i++) {\n      vec3 p = ro + rd * t;\n      if (p.y < height(p.xz, iTime)) { hit = true; break; }\n      tp = t; dt = max(0.4, t * 0.05); t += dt;\n    }\n    if (hit) {\n      float a = tp, b = t;\n      for (int i = 0; i < 6; i++) {\n        float m = 0.5 * (a + b); vec3 p = ro + rd * m;\n        if (p.y < height(p.xz, iTime)) b = m; else a = m;\n      }\n      t = b; vec3 p = ro + rd * t; float e = 0.05 + 0.01 * t;\n      float h0 = height(p.xz, iTime);\n      vec3 n = normalize(vec3(h0 - height(p.xz + vec2(e, 0.0), iTime), e, h0 - height(p.xz + vec2(0.0, e), iTime)));\n      float f = 0.02 + 0.98 * pow(1.0 - max(dot(n, -rd), 0.0), 5.0);\n      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);\n      col = mix(water, sky(reflect(rd, n)), f);\n      col = mix(col, sky(vec3(rd.x, 0.02, rd.z)), 1.0 - exp(-t * 0.004));\n    }\n  }\n  col = 1.0 - exp(-col * 1.3);\n  fragColor = vec4(pow(col, vec3(1.0 / 2.2)), 1.0);\n}\n",
   "basis": "original",
   "license_note": "written for this index",
   "execution_fidelity": "reduced-sandbox",
   "proof": {
    "kind": "rendered",
    "label": "rendered 2026-11-29",
    "ok": true,
    "proof": {
     "ok": true,
     "technique": "jonswap-spectrum",
     "runtime": "glsl-fragment",
     "checked_at": "2026-11-29T15:51:50.471Z",
     "renderer": "Chromium 145.0.7632.6 headless, WebGL2 via ANGLE/SwiftShader, 512×512, iTime=1.5",
     "stats": {
      "mean": 0.667,
      "std": 0.1793,
      "unique_colors": 116
     },
     "image": "/specimens/jonswap-spectrum-specimen.webp",
     "reason": null
    }
   }
  }
 ],
 "related": [
  "fft-ocean",
  "gerstner-waves"
 ],
 "extends": [],
 "supersedes": [],
 "combines_with": [
  {
   "id": "fft-ocean",
   "why": "Supplies the initial h0(k) amplitudes whose time evolution the FFT then evaluates."
  }
 ],
 "provenance": {
  "prose": "original text written for this index (research draft, editorially reviewed)",
  "sources_verified_at": "2026-11-29T15:51:27.588Z",
  "draft": "data/drafts/volumes/jonswap-spectrum.json"
 },
 "solves": [
  "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"
 ],
 "authority": "Horvath, 2015",
 "url": "https://texelatlas.vercel.app/t/jonswap-spectrum/",
 "execution_fidelity": "reduced-sandbox",
 "fidelity_label": "Analytic Sandbox",
 "benchmark_eligible": true,
 "gpu_weight": {
  "weight_x": 75.42,
  "tier": "extreme",
  "p50_ms": 2.4812,
  "p95_ms": 2.5715,
  "baseline_p50_ms": 0.0329,
  "gpu": "Tesla T4/PCIe/SSE2",
  "resolution": "1920x1080",
  "method": "opengl-timer-query",
  "frames": 40,
  "preset_id": "jonswap-spectrum-specimen",
  "execution_fidelity": "reduced-sandbox",
  "fidelity_label": "Analytic Sandbox",
  "benchmark_eligible": true,
  "generated_at": "2026-11-30T21:07:47Z",
  "l4": {
   "weight_x": 56.77,
   "tier": "heavy",
   "p50_ms": 0.9027,
   "p95_ms": 0.9237,
   "speedup_x": 2.75,
   "gpu": "NVIDIA L4/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0159
  },
  "a100": {
   "weight_x": 47.65,
   "tier": "heavy",
   "p50_ms": 1.3724,
   "p95_ms": 1.3839,
   "speedup_x": 1.81,
   "gpu": "NVIDIA A100-SXM4-40GB/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0288
  }
 }
}