{
  "license": "CC0-1.0",
  "shader": {
    "id": "z1j2ng6a",
    "title": "Mandelbox Reliquary",
    "license": "CC0-1.0",
    "provenance_type": "witnessed_generation",
    "made_with": "glslop",
    "status": "active",
    "compile_ok": true,
    "tags": [
      "fractal",
      "kifs",
      "mandelbox",
      "neon",
      "portals"
    ],
    "parents": [],
    "author": "zazi5inxhmgi",
    "author_name": "ufffd",
    "author_url": "/u/ufffd",
    "created_at": "2026-06-18T03:08:27.737Z",
    "poster_url": "/posters/z1j2ng6a.avif",
    "stats": {
      "slops": 1,
      "views": 100,
      "forks": 0
    },
    "self": "/api/v1/shaders/z1j2ng6a",
    "isf": "/*{\n  \"DESCRIPTION\": \"Laser Mandelbox: a box-fold/sphere-fold KIFS field that slowly tumbles and resolves into glowing cathedral shapes, raymarched in near-black with bold hot laser lines etched along its folds. Electric neon, real-time, seamless 16s loop.\",\n  \"CREDIT\": \"glslop agent (Claude)\",\n  \"CATEGORIES\": [\"fractal\", \"raymarch\", \"neon\", \"mandelbox\"],\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\": \"boxScale\",  \"TYPE\": \"float\", \"DEFAULT\": 2.05, \"MIN\": -3.0,\"MAX\": 3.0 },\n    { \"NAME\": \"tumble\",    \"TYPE\": \"float\", \"DEFAULT\": 0.5,  \"MIN\": 0.0, \"MAX\": 1.5 },\n    { \"NAME\": \"zoom\",      \"TYPE\": \"float\", \"DEFAULT\": 1.0,  \"MIN\": 0.5, \"MAX\": 2.0 },\n    { \"NAME\": \"iterCount\", \"TYPE\": \"long\",  \"DEFAULT\": 8,    \"MIN\": 4,   \"MAX\": 14 }\n  ]\n}*/\n\n#define PI  3.14159265359\n#define TAU 6.28318530718\n\nconst float PERIOD = 16.0;   // seconds per seamless loop\nconst int   MAXI   = 14;     // hard cap on KIFS iterations (>= iterCount MAX)\nconst int   STEPS  = 100;    // raymarch steps (kept low for real-time)\n\nmat2 rot(float a){ float c = cos(a), s = sin(a); return mat2(c, -s, s, c); }\n\n// electric neon palette (cyan / magenta / violet, not a flat rainbow)\nvec3 pal(float t){\n  return 0.5 + 0.5 * cos(TAU * (t + vec3(0.55, 0.40, 0.18)));\n}\n\n// Mandelbox DE (Tglad box-fold + sphere-fold). Conservative -> clean march.\n// No sqrt in the loop (squared traps) for speed.\n// trap -> body color ; lineT2 -> squared dist to nearest axis (laser lines).\nfloat map(vec3 p, mat2 R1, mat2 R2, out float trap, out float lineT2){\n  float fs = 3.8;                   // shrink the fractal so it reads as an object\n  vec3 c = p * fs;\n  c.xz = R1 * c.xz;                 // rigid tumble of the whole fractal\n  c.xy = R2 * c.xy;\n  vec3 z = c;\n  float dr = 1.0;\n  trap = 1.0e9; lineT2 = 1.0e9;\n  for (int i = 0; i < MAXI; i++){\n    if (i >= iterCount) break;\n    z = clamp(z, -1.0, 1.0) * 2.0 - z;            // box fold\n    float r2 = dot(z, z);                          // sphere fold\n    if (r2 < 0.25){ z *= 4.0; dr *= 4.0; }         // 1/minR2, minR2 = 0.25\n    else if (r2 < 1.0){ float s = 1.0 / r2; z *= s; dr *= s; }\n    z = z * boxScale + c;\n    dr = dr * abs(boxScale) + 1.0;\n    trap   = min(trap, dot(z, z));\n    lineT2 = min(lineT2, min(min(dot(z.xy, z.xy), dot(z.yz, z.yz)), dot(z.xz, z.xz)));\n  }\n  return length(z) / abs(dr) / fs;        // undo the input scale\n}\n\nvoid main(){\n  vec2 uv = (gl_FragCoord.xy - 0.5 * RENDERSIZE.xy) / RENDERSIZE.y;\n\n  // seamless loop: every angle is sin/cos of an integer multiple of th.\n  // Gentle, eased motion so the fractal settles into readable shapes.\n  float ph = fract(TIME * speed / PERIOD);\n  float th = TAU * ph;\n  mat2 R1 = rot(th);                                   // one slow tumble / loop\n  mat2 R2 = rot(0.4 + 0.18 * tumble * sin(th));        // gentle breathing fold\n\n  // calm camera: mostly parked, slight eased drift\n  float camDist = 8.0 * zoom;\n  float az = 0.18 * sin(th);\n  float el = 0.32 + 0.10 * 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.6 * fwd);\n\n  // ---- surface raymarch ----\n  float t = 0.05;\n  float tcap = camDist + 8.0;\n  float trap = 1.0e9, lineT2 = 1.0e9, trapHit = 1.0e9, lineHit2 = 1.0e9, te = 0.0;\n  bool hit = false;\n  for (int i = 0; i < STEPS; i++){\n    vec3 p = ro + rd * t;\n    float tr, l2;\n    float d = map(p, R1, R2, tr, l2);\n    if (d < 0.0005 * t){ hit = true; trapHit = tr; lineHit2 = l2; 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    // 4-tap tetrahedron normal (cheaper than 6-tap central difference)\n    vec2 k = vec2(1.0, -1.0);\n    float e = 0.0013, tr, l2;\n    vec3 n = normalize(\n      k.xyy * map(p + k.xyy * e, R1, R2, tr, l2) +\n      k.yyx * map(p + k.yyx * e, R1, R2, tr, l2) +\n      k.yxy * map(p + k.yxy * e, R1, R2, tr, l2) +\n      k.xxx * map(p + k.xxx * e, R1, R2, tr, l2));\n\n    vec3 body = pal(hue + 0.55 * sqrt(trapHit) + 0.14 * te);   // richer colour spread\n    vec3 lig  = normalize(vec3(0.4, 0.8, 0.45));\n    float dif = max(dot(n, lig), 0.0);\n    float fres = pow(1.0 - max(dot(n, -rd), 0.0), 2.3);\n\n    // bold hot laser lines along the folds (lineHit2 is already squared)\n    float laser = 1.0 / (1.0 + 110.0 * lineHit2);\n    laser = pow(laser, 1.6);\n    vec3 laserCol = mix(vec3(0.9, 0.97, 1.0), body + 0.4, 0.3);\n\n    col += body * 0.025;                   // near-black body\n    col += body * dif * 0.07;              // faint shading\n    col += body * fres * 2.1 * glow;       // rim glow -> pops the portal rings\n    col += laserCol * laser * 8.0 * glow;  // the LASER lines dominate\n    // depth fog -> far structure fades into black for clean 3D depth\n    col *= exp(-0.20 * max(te - camDist + 3.5, 0.0));\n  }\n\n  // tone map: hot cores blow to white, halos stay saturated\n  col *= 1.08;\n  col = col / (1.0 + col);\n  col = pow(col, vec3(0.76));\n  col *= 1.0 - 0.24 * dot(uv, uv);         // vignette\n\n  gl_FragColor = vec4(col, 1.0);\n}\n",
    "generator": {
      "model": "claude-opus-4-8",
      "provider": "Anthropic",
      "prompt": null,
      "params": null
    }
  }
}