{
  "license": "CC0-1.0",
  "shader": {
    "id": "gxmhgi4r",
    "title": "Gilded Quaternion",
    "license": "CC0-1.0",
    "provenance_type": "witnessed_generation",
    "made_with": "glslop",
    "status": "active",
    "compile_ok": true,
    "tags": [
      "fractal",
      "julia",
      "quaternion",
      "neon",
      "organic"
    ],
    "parents": [],
    "author": "zazi5inxhmgi",
    "author_name": "ufffd",
    "author_url": "/u/ufffd",
    "created_at": "2026-06-18T04:14:59.809Z",
    "poster_url": "/posters/gxmhgi4r.avif",
    "stats": {
      "slops": 0,
      "views": 121,
      "forks": 0
    },
    "self": "/api/v1/shaders/gxmhgi4r",
    "isf": "/*{\n  \"DESCRIPTION\": \"Quaternion Julia: a smooth bulbous organic 4D Julia fractal (q -> q^2 + c) raymarched with the analytic distance estimate, electric orbit-trap colour and hot rim light. The seed c drifts on a circle so the creature slowly morphs and tumbles. Real-time, seamless 16s loop.\",\n  \"CREDIT\": \"glslop agent (Claude); quaternion Julia DE after Inigo Quilez\",\n  \"CATEGORIES\": [\"fractal\", \"raymarch\", \"neon\", \"julia\"],\n  \"INPUTS\": [\n    { \"NAME\": \"speed\",     \"TYPE\": \"float\", \"DEFAULT\": 1.0,  \"MIN\": 0.0, \"MAX\": 3.0 },\n    { \"NAME\": \"glow\",      \"TYPE\": \"float\", \"DEFAULT\": 1.0,  \"MIN\": 0.3, \"MAX\": 3.0 },\n    { \"NAME\": \"hue\",       \"TYPE\": \"float\", \"DEFAULT\": 0.0,  \"MIN\": 0.0, \"MAX\": 1.0 },\n    { \"NAME\": \"morph\",     \"TYPE\": \"float\", \"DEFAULT\": 0.5,  \"MIN\": 0.0, \"MAX\": 1.2 },\n    { \"NAME\": \"zoom\",      \"TYPE\": \"float\", \"DEFAULT\": 1.0,  \"MIN\": 0.5, \"MAX\": 2.0 },\n    { \"NAME\": \"iterCount\", \"TYPE\": \"long\",  \"DEFAULT\": 10,   \"MIN\": 5,   \"MAX\": 14 }\n  ]\n}*/\n\n#define PI  3.14159265359\n#define TAU 6.28318530718\n\nconst float PERIOD = 16.0;\nconst int   MAXI   = 14;\nconst int   STEPS  = 110;\n\nmat2 rot(float a){ float c = cos(a), s = sin(a); return mat2(c, -s, s, c); }\n\nvec3 pal(float t){\n  return 0.5 + 0.5 * cos(TAU * (t + vec3(0.55, 0.40, 0.18)));\n}\n\n// Quaternion Julia DE.  c = seed quaternion ; trap = orbit trap for colour.\nfloat map(vec3 p, vec4 c, mat2 Rt, out vec4 trap){\n  p.xz = Rt * p.xz;\n  vec4 z = vec4(p, 0.0);\n  float md2 = 1.0;            // running |dz|^2\n  float mz2 = dot(z, z);\n  trap = vec4(abs(z.xyz), mz2);\n  for (int i = 0; i < MAXI; i++){\n    if (i >= iterCount) break;\n    md2 *= 4.0 * mz2;                                   // |dz| <- |2 z dz|\n    z = vec4(z.x * z.x - dot(z.yzw, z.yzw), 2.0 * z.x * z.yzw) + c;  // z <- z^2 + c\n    trap = min(trap, vec4(abs(z.xyz), dot(z, z)));\n    mz2 = dot(z, z);\n    if (mz2 > 6.0) break;\n  }\n  return 0.25 * sqrt(mz2 / md2) * log(mz2);             // analytic distance estimate\n}\n\nvoid main(){\n  vec2 uv = (gl_FragCoord.xy - 0.5 * RENDERSIZE.xy) / RENDERSIZE.y;\n\n  float ph = fract(TIME * speed / PERIOD);\n  float th = TAU * ph;\n  // seed drifts on a small circle (seamless) -> the creature morphs\n  vec4 c = vec4(-0.45, 0.55, 0.36, 0.18)\n         + morph * 0.12 * vec4(cos(th), sin(th), cos(2.0 * th), sin(2.0 * th));\n  mat2 Rt = rot(th);\n\n  float camDist = 2.7 * zoom;\n  float az = 0.2 * sin(th);\n  float el = 0.25 + 0.12 * sin(th);\n  vec3 ro = camDist * vec3(sin(az) * cos(el), sin(el), cos(az) * cos(el));\n  vec3 ta = vec3(0.0);\n  vec3 fwd = normalize(ta - ro);\n  vec3 rgt = normalize(cross(vec3(0.0, 1.0, 0.0), fwd));\n  vec3 upv = cross(fwd, rgt);\n  vec3 rd  = normalize(uv.x * rgt + uv.y * upv + 1.7 * fwd);\n\n  // ---- surface raymarch ----\n  float t = 0.02;\n  float tcap = camDist + 3.0;\n  vec4 trapHit = vec4(0.0);\n  float te = 0.0;\n  bool hit = false;\n  for (int i = 0; i < STEPS; i++){\n    vec3 p = ro + rd * t;\n    vec4 tr;\n    float d = map(p, c, Rt, tr);\n    if (d < 0.0004 * t){ hit = true; trapHit = tr; te = t; break; }\n    t += d * 0.85;\n    if (t > tcap) break;\n  }\n\n  vec3 col = vec3(0.0);\n\n  if (hit){\n    vec3 p = ro + rd * te;\n    vec2 k = vec2(1.0, -1.0);\n    float e = 0.0008;\n    vec4 tr;\n    vec3 n = normalize(\n      k.xyy * map(p + k.xyy * e, c, Rt, tr) +\n      k.yyx * map(p + k.yyx * e, c, Rt, tr) +\n      k.yxy * map(p + k.yxy * e, c, Rt, tr) +\n      k.xxx * map(p + k.xxx * e, c, Rt, tr));\n\n    // electric colour from the orbit trap + a little spatial variation\n    vec3 base = pal(hue + 0.30 + 0.55 * trapHit.w + 0.5 * trapHit.x\n                    + 0.3 * trapHit.z + 0.18 * length(p));\n    vec3 lig  = normalize(vec3(0.5, 0.8, 0.4));\n    float dif = max(dot(n, lig), 0.0);\n    float fres = pow(1.0 - max(dot(n, -rd), 0.0), 2.2);\n    float ao  = clamp(0.5 + 0.5 * n.y, 0.3, 1.0);\n\n    col += base * 0.10 * ao;\n    col += base * dif * 0.34 * ao;\n    col += base * fres * 3.0 * glow;                 // electric rim\n    col += vec3(1.0) * pow(fres, 5.0) * 0.8 * glow;\n    col *= exp(-0.18 * max(te - camDist + 1.3, 0.0));\n  }\n\n  col = col / (1.0 + col);\n  col = pow(col, vec3(0.78));\n  col *= 1.0 - 0.22 * dot(uv, uv);\n\n  gl_FragColor = vec4(col, 1.0);\n}\n",
    "generator": {
      "model": "claude-opus-4-8",
      "provider": "Anthropic",
      "prompt": null,
      "params": null
    }
  }
}