{
  "format": "field",
  "version": 1,
  "meta": {
    "name": "Kelvin-Helmholtz Shear Billows",
    "author": "Infinite",
    "description": "Stratified fluid shear layer curling into breaking Kelvin-Helmholtz vortex billows with multi-octave vorticity advection.",
    "domain": "pixel"
  },
  "device": {
    "code": "param float shearRate = 1.85 [0.6, 4.0];\nparam float curlGain = 1.45 [0.3, 3.0];\nparam float waveFreq = 3.2 [1.2, 7.0];\nparam float billowSharp = 1.6 [0.5, 3.2];\nparam float drift = 0.24 [0.0, 0.8];\n\np = vec2((uv.x - 0.5) * aspect, uv.y - 0.5) * 2.0;\n\n# Stratified shear velocity profile along y\nsy = p.y * shearRate;\nshear = sy / (1.0 + abs(sy));\nq = vec2(p.x * waveFreq + shear * 1.4 - t * drift * 1.1, p.y * waveFreq);\n\n# Multi-stage vortex roll-up advection\nv1 = sin(q.x * 1.5 + cos(q.y * 1.3 + t * drift));\nv2 = cos(q.y * 1.7 - sin(q.x * 1.4 - t * drift * 0.8));\nq1 = q + vec2(v1, v2) * curlGain * exp(-p.y * p.y * 1.6);\n\nw1 = sin(q1.x * 2.3 + sin(q1.y * 2.6 + v1 * 1.8));\nw2 = cos(q1.y * 3.1 - cos(q1.x * 2.9 - v2 * 1.7));\nq2 = q1 + vec2(w1, w2) * 0.65 * curlGain;\n\n# Crest ridge and stratified streamline density\nridge = abs(sin(q2.x * 1.8 + cos(q2.y * 2.1)));\ncrest = exp(-ridge * 3.8 * billowSharp);\nsz = (p.y + 0.22 * w1 + 0.14 * w2) * 2.4;\nsheet = 0.5 + 0.5 * (sz / (1.0 + abs(sz)));\n\ncAbyss = vec3(0.059, 0.090, 0.133);\ncPelagic = vec3(0.208, 0.325, 0.431);\ncGlacial = vec3(0.620, 0.769, 0.859);\ncFoam = vec3(0.910, 0.886, 0.835);\n\ncol = mix(cAbyss, cPelagic, smoothstep(0.15, 0.75, sheet));\ncol = mix(col, cGlacial, smoothstep(0.22, 0.82, crest * 0.85 + sheet * 0.35));\ncol = mix(col, cFoam, smoothstep(0.55, 0.98, crest));\ncol = clamp(col, 0.0, 1.0);\n",
    "params": {
      "shearRate": 1.85,
      "curlGain": 1.45,
      "waveFreq": 3.2,
      "billowSharp": 1.6,
      "drift": 0.24
    },
    "nodeSettings": {
      "width": 1080.0,
      "height": 1080.0,
      "animate": 1.0
    }
  }
}
