{
  "format": "field",
  "version": 1,
  "meta": {
    "name": "Cathedral Stained Caustics",
    "author": "Infinite",
    "description": "Leaded stained-glass mosaic with jewel-tone refractive cells, dark lead came mullions, and gentle caustic light shimmer across crimson, cobalt, and amber panes.",
    "domain": "pixel"
  },
  "device": {
    "code": "# Cathedral Stained Caustics (Field Pixel)\nparam float grid_cols = 12.0 [6.0, 24.0];\nparam float grid_rows = 12.0 [6.0, 24.0];\nparam float caustic_glow = 0.42 [0.0, 1.0];\n\np = vec2((uv.x - 0.5) * aspect, uv.y - 0.5);\ng = vec2(uv.x * grid_cols * aspect, uv.y * grid_rows);\nid = floor(g);\nf = fract(g);\n\n# Lead came mullions\nmx = smoothstep(0.0, 0.08, f.x) * smoothstep(1.0, 0.92, f.x);\nmy = smoothstep(0.0, 0.08, f.y) * smoothstep(1.0, 0.92, f.y);\nmullion = mx * my;\n\n# Deterministic jewel-tone palette hash per pane\nh = fract(sin(dot(id, vec2(127.1, 311.7))) * 43758.5453);\ncRuby = vec3(0.784, 0.243, 0.231);\ncCobalt = vec3(0.157, 0.329, 0.604);\ncAmber = vec3(0.851, 0.635, 0.204);\ncEmerald = vec3(0.180, 0.490, 0.357);\ncIvory = vec3(0.890, 0.867, 0.816);\n\npaneCol = if(h < 0.22, cRuby, if(h < 0.46, cCobalt, if(h < 0.68, cAmber, if(h < 0.84, cEmerald, cIvory))));\n\n# Internal glass caustic ripple\nrip = 0.78 + 0.22 * sin(p.x * 14.0 + p.y * 11.0 + t * 1.4 + h * 6.283);\npaneLit = paneCol * (rip + caustic_glow * 0.35 * (1.0 - length(f - 0.5)));\n\ncLead = vec3(0.075, 0.078, 0.088);\ncol = clamp(mix(cLead, paneLit, mullion), 0.0, 1.0);\n",
    "params": {
      "grid_cols": 12.0,
      "grid_rows": 12.0,
      "caustic_glow": 0.42
    }
  }
}