{
  "format": "field",
  "version": 1,
  "meta": {
    "name": "Ferrofluid Rosensweig Spikes",
    "author": "Infinite",
    "description": "Hexagonal Rosensweig ferrofluid magnetic spike lattice with glossy obsidian specular highlights, meniscus wave ripples, and warm brass-amber basin reflections.",
    "domain": "pixel"
  },
  "device": {
    "code": "# Ferrofluid Rosensweig Spikes (Field Pixel)\nparam float lattice = 34.0 [18.0, 56.0];\nparam float spikeGain = 1.35 [0.5, 2.2];\nparam float flux = 0.45 [0.0, 1.2];\n\np = vec2((uv.x - 0.5) * aspect, uv.y - 0.5);\nr = length(p);\nmask = smoothstep(0.42, 0.24, r);\nrim = exp(-pow((r - 0.41) * 32.0, 2.0));\n\n# Hexagonal 3-wave Rosensweig instability interference\nq = p * lattice;\nw1 = cos(q.x + t * flux);\nw2 = cos(-0.5 * q.x + 0.866025 * q.y - t * flux * 0.8);\nw3 = cos(-0.5 * q.x - 0.866025 * q.y + t * flux * 0.6);\nhex = (w1 + w2 + w3) / 3.0;\nspike = pow(clamp(0.5 + 0.5 * hex, 0.0, 1.0), 3.2) * spikeGain * mask;\n\n# True 3-wave hexagonal gradient for sharp specular highlights\ns1 = sin(q.x + t * flux);\ns2 = sin(-0.5 * q.x + 0.866025 * q.y - t * flux * 0.8);\ns3 = sin(-0.5 * q.x - 0.866025 * q.y + t * flux * 0.6);\ngx = (-s1 + 0.5 * s2 + 0.5 * s3) * 0.65;\ngy = (-0.866025 * s2 + 0.866025 * s3) * 0.65;\nnrm = normalize(vec3(-gx * 1.8 * mask, -gy * 1.8 * mask, 0.38));\n\nlightDir = normalize(vec3(0.45, 0.65, 0.72));\nviewDir = vec3(0.0, 0.0, 1.0);\nhalfVec = normalize(lightDir + viewDir);\nspec = pow(max(dot(nrm, halfVec), 0.0), 42.0);\nfres = pow(1.0 - max(nrm.z, 0.0), 2.5);\n\ncBasin = vec3(0.110, 0.090, 0.068);\ncBrass = vec3(0.753, 0.584, 0.318);\ncObsidian = vec3(0.025, 0.028, 0.034);\ncCream = vec3(0.961, 0.902, 0.784);\n\ncol = mix(cBasin, cObsidian, mask * 0.92);\ncol = mix(col, cBrass * 0.82, fres * (0.35 + 0.65 * spike));\ncol = clamp(col + spec * cCream * (0.25 + 0.85 * mask) + rim * 0.45 * cBrass + spike * 0.22 * cBrass, 0.0, 1.0);\n",
    "params": {
      "lattice": 34.0,
      "spikeGain": 1.35,
      "flux": 0.45
    }
  }
}