{
  "license": "CC0-1.0",
  "shader": {
    "id": "9ydg2vd0",
    "title": "Tidal Reliquary",
    "license": "CC0-1.0",
    "provenance_type": "witnessed_generation",
    "made_with": "Codex",
    "status": "active",
    "compile_ok": true,
    "tags": [
      "raymarch",
      "organic",
      "aperture",
      "orbital",
      "iridescent",
      "fracture"
    ],
    "parents": [],
    "author": "6vgonuus3b6m",
    "author_name": "kylegrover",
    "author_url": "/u/kylegrover",
    "created_at": "2026-07-18T04:50:35.623Z",
    "poster_url": "/posters/9ydg2vd0.avif",
    "stats": {
      "slops": 0,
      "views": 122,
      "forks": 0
    },
    "self": "/api/v1/shaders/9ydg2vd0",
    "isf": "/*{\n  \"DESCRIPTION\": \"A tidal reliquary suspended in deep space: a faceted mineral aperture, eight breathing petals, and a tilted choir of orbital filaments. Thin-film color travels by view angle and accumulated depth, so the object stays jewel-bright while its black heart remains a true void.\",\n  \"CREDIT\": \"Codex\",\n  \"CATEGORIES\": [\"Raymarch\", \"Abstract\", \"Organic\", \"Generative\"],\n  \"INPUTS\": [\n    { \"NAME\": \"speed\", \"TYPE\": \"float\", \"DEFAULT\": 0.42, \"MIN\": 0.0, \"MAX\": 2.0 },\n    { \"NAME\": \"bloom\", \"TYPE\": \"float\", \"DEFAULT\": 1.18, \"MIN\": 0.0, \"MAX\": 2.5 },\n    { \"NAME\": \"lattice\", \"TYPE\": \"float\", \"DEFAULT\": 0.82, \"MIN\": 0.2, \"MAX\": 1.4 },\n    { \"NAME\": \"hue\", \"TYPE\": \"float\", \"DEFAULT\": 0.56, \"MIN\": 0.0, \"MAX\": 1.0 },\n    { \"NAME\": \"orbit\", \"TYPE\": \"float\", \"DEFAULT\": 0.72, \"MIN\": 0.0, \"MAX\": 1.6 }\n  ]\n}*/\n\n#define PI 3.14159265359\n#define TAU 6.28318530718\n\nvec3 rotX(vec3 p, float a){\n  float c = cos(a), s = sin(a);\n  return vec3(p.x, c * p.y - s * p.z, s * p.y + c * p.z);\n}\n\nvec3 rotY(vec3 p, float a){\n  float c = cos(a), s = sin(a);\n  return vec3(c * p.x + s * p.z, p.y, -s * p.x + c * p.z);\n}\n\nvec3 rotZ(vec3 p, float a){\n  float c = cos(a), s = sin(a);\n  return vec3(c * p.x - s * p.y, s * p.x + c * p.y, p.z);\n}\n\nfloat hash21(vec2 p){\n  p = fract(p * vec2(123.34, 456.21));\n  p += dot(p, p + 45.32);\n  return fract(p.x * p.y);\n}\n\nfloat hash31(vec3 p){\n  p = fract(p * 0.1031);\n  p += dot(p, p.yzx + 33.33);\n  return fract((p.x + p.y) * p.z);\n}\n\nvec3 spectral(float x){\n  return 0.5 + 0.5 * cos(TAU * (x + hue + vec3(0.0, 0.325, 0.66)));\n}\n\nvec2 opUnion(vec2 a, vec2 b){\n  return a.x < b.x ? a : b;\n}\n\nfloat sdTorus(vec3 p, vec2 t){\n  vec2 q = vec2(length(p.xz) - t.x, p.y);\n  return length(q) - t.y;\n}\n\nfloat sdCapsule(vec3 p, vec3 a, vec3 b, float r){\n  vec3 ab = b - a;\n  float h = clamp(dot(p - a, ab) / dot(ab, ab), 0.0, 1.0);\n  return length(p - mix(a, b, h)) - r;\n}\n\nfloat sdEllipsoid(vec3 p, vec3 r){\n  return (length(p / r) - 1.0) * min(min(r.x, r.y), r.z);\n}\n\nfloat sdOctahedron(vec3 p, float s){\n  p = abs(p);\n  return (p.x + p.y + p.z - s) * 0.57735027;\n}\n\nvec3 reliquaryDomain(vec3 p, float tm){\n  p = rotY(p, tm * 0.23 * orbit);\n  p = rotX(p, 0.32 + 0.11 * sin(tm * 0.31 * orbit));\n  p = rotZ(p, -0.18 + tm * 0.13 * orbit);\n  return p;\n}\n\nvec2 sceneMap(vec3 p, float tm){\n  vec3 q = reliquaryDomain(p, tm);\n  vec2 result = vec2(100.0, 0.0);\n\n  float radius = length(q);\n  float azimuth = atan(q.z, q.x);\n  float facet = 0.052 * cos(8.0 * azimuth + 2.0 * q.y + tm * 0.18);\n  facet += 0.025 * cos(13.0 * azimuth - q.y * 11.0 - tm * 0.11);\n  float lobe = 0.042 * pow(0.5 + 0.5 * cos(8.0 * azimuth + tm * 0.15), 3.0);\n  float shellRadius = 0.765 + lobe + facet * (0.62 + 0.38 * lattice);\n  float shell = abs(radius - shellRadius) - 0.020;\n  // Subtract a slightly breathing cylinder from the membrane.  This opens\n  // the front of the reliquary onto the dark core instead of letting the\n  // shell become a featureless sphere in the middle of the frame.\n  float apertureRadius = 0.285 + 0.025 * sin(q.y * 5.0 + tm * 0.4);\n  float aperture = length(q.xy) - apertureRadius;\n  shell = max(shell, -aperture);\n  result = opUnion(result, vec2(shell, 1.0));\n\n  // A small dark body gives the object a readable aperture instead of a\n  // frame-filling tangle of additive lines.\n  result = opUnion(result, vec2(radius - 0.225, 2.0));\n  result = opUnion(result, vec2(sdTorus(q, vec2(0.335, 0.018)), 3.0));\n\n  // A ring of small tide-beads makes the aperture feel engineered rather\n  // than merely subtracted from the shell.\n  for (int i = 0; i < 8; i++){\n    float fi = float(i);\n    float beadAngle = fi * TAU / 8.0 + tm * 0.08;\n    vec3 beadCenter = vec3(cos(beadAngle) * 0.305,\n                           sin(beadAngle) * 0.305,\n                           0.0);\n    float bead = length(q - beadCenter) - (0.020 + 0.004 * lattice);\n    result = opUnion(result, vec2(bead, 8.0));\n  }\n\n  // Eight soft mineral petals, each with its own breathing tilt.\n  for (int i = 0; i < 8; i++){\n    float fi = float(i);\n    float a = fi * TAU / 8.0 + 0.12 * sin(tm * 0.5 + fi * 1.7);\n    vec3 c = vec3(cos(a) * 0.70,\n                  0.075 * sin(a * 2.0 + tm * 0.33),\n                  sin(a) * 0.70);\n    vec3 pp = rotY(q - c, a);\n    pp = rotZ(pp, 0.16 * sin(tm * 0.43 + fi * 1.2));\n    float petal = sdEllipsoid(pp, vec3(0.34, 0.13, 0.075));\n    result = opUnion(result, vec2(petal, 4.0));\n  }\n\n  // A six-spoke internal skeleton anchors the petals to the aperture.\n  for (int i = 0; i < 6; i++){\n    float fi = float(i);\n    float a = fi * TAU / 6.0 + 0.08 * sin(tm * 0.29 + fi);\n    vec3 a0 = vec3(cos(a) * 0.24, 0.0, sin(a) * 0.24);\n    vec3 b0 = vec3(cos(a) * 0.93,\n                   0.045 * sin(fi * 2.4 + tm * 0.4),\n                   sin(a) * 0.93);\n    float spoke = sdCapsule(q, a0, b0, 0.010 + 0.004 * lattice);\n    result = opUnion(result, vec2(spoke, 5.0));\n  }\n\n  // The tilted rings are deliberately not coplanar: their intersections are\n  // the bright, impossible-looking knots around the shell.\n  for (int i = 0; i < 5; i++){\n    float fi = float(i);\n    vec3 rp = rotX(q, 0.24 + fi * 0.48 + 0.09 * sin(tm * 0.21 + fi));\n    rp = rotZ(rp, fi * 0.91 + 0.11 * cos(tm * 0.17 + fi * 1.9));\n    float major = 0.88 + 0.045 * sin(fi * 1.73 + tm * 0.20);\n    float minor = 0.012 + 0.006 * lattice;\n    result = opUnion(result, vec2(sdTorus(rp, vec2(major, minor)), 6.0));\n  }\n\n  // Six floating diamond nodes punctuate the outside of the flower.\n  for (int i = 0; i < 6; i++){\n    float fi = float(i);\n    float a = fi * TAU / 6.0 + 0.15 * tm * orbit;\n    vec3 c = vec3(cos(a) * 0.93,\n                  0.16 * sin(a * 1.5 + tm * 0.2),\n                  sin(a) * 0.93);\n    vec3 cp = rotY(q - c, a);\n    cp = rotZ(cp, 0.25 + 0.12 * sin(fi + tm * 0.27));\n    float crystal = sdOctahedron(cp, 0.155 + 0.025 * sin(fi * 2.2 + tm * 0.4));\n    result = opUnion(result, vec2(crystal, 7.0));\n  }\n\n  return result;\n}\n\nvec3 sceneNormal(vec3 p, float tm){\n  float e = 0.0018;\n  vec2 k = vec2(1.0, -1.0);\n  return normalize(\n    k.xyy * sceneMap(p + k.xyy * e, tm).x +\n    k.yyx * sceneMap(p + k.yyx * e, tm).x +\n    k.yxy * sceneMap(p + k.yxy * e, tm).x +\n    k.xxx * sceneMap(p + k.xxx * e, tm).x\n  );\n}\n\nfloat orbitalLines(vec3 p, float tm){\n  vec3 q = reliquaryDomain(p, tm);\n  float r = length(q);\n  float g = 0.0;\n\n  for (int i = 0; i < 4; i++){\n    float fi = float(i);\n    vec3 rp = rotX(q, 0.33 + fi * 0.68 + tm * (0.035 + fi * 0.009));\n    rp = rotZ(rp, fi * 1.21 - tm * 0.025);\n    float ring = abs(sdTorus(rp, vec2(0.88 + 0.045 * fi, 0.016)));\n    g += exp(-ring * 76.0) * (0.55 + 0.12 * sin(fi + tm));\n  }\n\n  float azimuth = atan(q.z, q.x);\n  float weave = abs(sin(azimuth * 6.0 + q.y * 10.0 + tm * 0.47));\n  float weaveLine = exp(-weave * 18.0) * exp(-abs(r - 0.72) * 17.0);\n  g += weaveLine * 0.9 * lattice;\n\n  float shellLine = exp(-abs(r - (0.765 + 0.035 * sin(azimuth * 8.0 + q.y * 2.0))) * 38.0);\n  g += shellLine * 0.38;\n  return g;\n}\n\nvec3 background(vec2 uv, vec3 rd, float tm){\n  vec3 col = vec3(0.0015, 0.003, 0.012);\n  float horizon = exp(-3.0 * abs(uv.y + 0.06));\n  col += vec3(0.006, 0.014, 0.042) * horizon;\n\n  vec2 starUv = rd.xy / max(abs(rd.z), 0.22) * 38.0;\n  vec2 cell = floor(starUv);\n  vec2 local = fract(starUv) - 0.5;\n  float seed = hash21(cell);\n  float star = (1.0 - smoothstep(0.0, 0.065, length(local))) * step(0.985, seed);\n  float pulse = 0.72 + 0.28 * sin(tm * 1.4 + seed * 80.0);\n  col += spectral(0.18 + seed * 0.23) * star * pulse * 0.33;\n\n  vec2 cell2 = floor(starUv * 0.47 + vec2(17.0, -8.0));\n  vec2 local2 = fract(starUv * 0.47 + vec2(17.0, -8.0)) - 0.5;\n  float seed2 = hash21(cell2 + 4.7);\n  float star2 = (1.0 - smoothstep(0.0, 0.04, length(local2))) * step(0.993, seed2);\n  col += vec3(0.18, 0.30, 0.70) * star2 * 0.42;\n\n  float dust = 0.5 + 0.5 * sin(uv.x * 4.0 + sin(uv.y * 7.0) + tm * 0.08);\n  dust *= 0.5 + 0.5 * sin(uv.y * 13.0 - uv.x * 2.0);\n  col += vec3(0.015, 0.004, 0.026) * dust * exp(-2.2 * dot(uv, uv));\n  return col;\n}\n\nvec3 shadeReliquary(vec3 p, vec3 rd, vec2 material, float tm){\n  vec3 q = reliquaryDomain(p, tm);\n  vec3 n = sceneNormal(p, tm);\n  float view = clamp(dot(-rd, n), 0.0, 1.0);\n  float rim = pow(1.0 - view, 3.0);\n  vec3 keyDir = normalize(vec3(-0.48, 0.77, 0.42));\n  vec3 fillDir = normalize(vec3(0.62, -0.20, -0.74));\n  float key = max(dot(n, keyDir), 0.0);\n  float fill = max(dot(n, fillDir), 0.0);\n  float glint = pow(max(dot(reflect(rd, n), keyDir), 0.0), 24.0);\n\n  float grain = 0.5 + 0.5 * sin(dot(q, vec3(8.2, 13.7, 5.1)) +\n                                 sin(q.x * 7.0 + q.z * 4.0) * 1.8);\n  float depthPhase = length(p) * 0.42 + dot(n, vec3(0.2, 0.6, 0.3)) * 0.35;\n  vec3 film = spectral(depthPhase + grain * 0.16 + tm * 0.018);\n  vec3 deep = vec3(0.006, 0.008, 0.030);\n  vec3 col = deep;\n\n  if (material.y < 1.5){\n    float grooves = 0.5 + 0.5 * cos(8.0 * atan(q.z, q.x) + q.y * 2.0 + tm * 0.18);\n    vec3 mineral = mix(vec3(0.012, 0.014, 0.042), vec3(0.055, 0.012, 0.088), grain);\n    mineral *= 0.65 + 0.35 * grooves;\n    col = mineral * (0.14 + 1.42 * key + 0.36 * fill);\n    col += film * (0.045 + 0.24 * key + 0.14 * rim);\n    col += rim * vec3(0.08, 0.25, 0.56);\n    col += glint * vec3(0.85, 0.63, 0.30);\n    // Two projected mode families make a restrained mineral crack network.\n    // It is keyed from position, not brightness, so the thin lines retain\n    // color while the body remains dark enough to frame the aperture.\n    float chladniA = sin(q.x * 7.0 + tm * 0.12) * sin(q.y * 11.0)\n                   - sin(q.y * 7.0) * sin(q.x * 11.0 + tm * 0.08);\n    float chladniB = sin(q.z * 9.0 - tm * 0.10) * sin(q.y * 5.0)\n                   - sin(q.y * 9.0) * sin(q.z * 5.0 + tm * 0.11);\n    float fracture = 0.5 * chladniA + 0.5 * chladniB;\n    float vein = 1.0 - smoothstep(0.012, 0.060, abs(fracture));\n    col *= 1.0 - vein * 0.28;\n    col += spectral(0.72 + q.y * 0.28 + tm * 0.03) * vein * (0.24 + 0.34 * key);\n    float fineA = sin(q.x * 16.0 - q.z * 3.0 + tm * 0.18) * sin(q.y * 13.0)\n                - sin(q.y * 16.0 + tm * 0.09) * sin(q.x * 3.0 + q.z * 13.0);\n    float fineVein = 1.0 - smoothstep(0.010, 0.034, abs(fineA));\n    col += spectral(0.48 + q.x * 0.22 - q.z * 0.16 + tm * 0.02) * fineVein * 0.15;\n  } else if (material.y < 2.5){\n    // The black heart only answers at its edge; the center is allowed to\n    // remain black so the eye has somewhere to rest.\n    col = vec3(0.00025, 0.00045, 0.002) * (0.3 + key);\n    col += rim * spectral(0.52 + tm * 0.03) * 0.18;\n    col += glint * vec3(0.22, 0.38, 0.72) * 0.42;\n  } else if (material.y < 3.5){\n    col = film * (0.24 + 1.24 * key) + rim * vec3(0.25, 0.64, 1.0);\n    col += glint * vec3(1.0, 0.84, 0.48) * 1.4;\n  } else if (material.y < 4.5){\n    float petalPhase = atan(q.z, q.x) / TAU + q.y * 0.28 + grain * 0.12;\n    vec3 petalFilm = spectral(petalPhase + tm * 0.025);\n    col = petalFilm * (0.18 + 1.35 * key + 0.26 * fill);\n    col += rim * vec3(0.10, 0.45, 0.92) + glint * vec3(0.94, 0.50, 0.25);\n  } else if (material.y < 5.5){\n    col = spectral(0.17 + q.y * 0.5 + tm * 0.04) * (0.55 + 1.45 * key);\n    col += vec3(0.34, 0.76, 1.0) * rim * 0.8;\n  } else if (material.y < 6.5){\n    col = spectral(0.63 + q.y * 0.4 + tm * 0.035) * (0.38 + 1.5 * key);\n    col += vec3(0.16, 0.58, 1.0) * rim * 0.65;\n    col += glint * vec3(1.0, 0.58, 0.18) * 1.2;\n  } else if (material.y < 8.5){\n    float beadPhase = atan(q.y, q.x) / TAU + tm * 0.03;\n    col = spectral(0.18 + beadPhase) * (0.60 + 1.45 * key);\n    col += rim * vec3(0.36, 0.82, 1.0) + glint * vec3(1.0, 0.70, 0.24) * 1.5;\n  } else {\n    col = spectral(0.08 + grain * 0.2 + tm * 0.03) * (0.28 + 1.28 * key);\n    col += vec3(0.24, 0.53, 1.0) * rim + glint * vec3(1.0, 0.70, 0.28);\n  }\n\n  return col;\n}\n\nvoid main(){\n  vec2 uv = (gl_FragCoord.xy - 0.5 * RENDERSIZE.xy) / RENDERSIZE.y;\n  float tm = TIME * speed;\n  vec3 ro = vec3(0.0, 0.015 * sin(tm * 0.31), 4.18);\n  vec3 rd = normalize(vec3(uv.x, uv.y, -1.72));\n\n  vec3 col = background(uv, rd, tm);\n  vec3 glow = vec3(0.0);\n  float t = 0.0;\n  float hit = -1.0;\n  vec2 hitMaterial = vec2(0.0);\n\n  for (int i = 0; i < 112; i++){\n    vec3 p = ro + rd * t;\n    vec2 field = sceneMap(p, tm);\n    float safeD = max(field.x, 0.0);\n    float stepSize = min(max(field.x * 0.56, 0.005), 0.13);\n    float line = orbitalLines(p, tm);\n    float core = exp(-length(reliquaryDomain(p, tm)) * 6.5);\n    float travelFade = exp(-0.16 * t);\n    vec3 lineColor = spectral(0.14 + t * 0.06 + tm * 0.018);\n    glow += lineColor * line * stepSize * 0.038 * bloom * travelFade;\n    glow += vec3(0.12, 0.34, 0.95) * core * stepSize * 0.012 * bloom * travelFade;\n\n    if (field.x < 0.0007 + 0.00012 * t){\n      hit = t;\n      hitMaterial = field;\n      break;\n    }\n    t += stepSize;\n    if (t > 7.0) break;\n  }\n\n  if (hit > 0.0){\n    vec3 p = ro + rd * hit;\n    vec3 surface = shadeReliquary(p, rd, hitMaterial, tm);\n    float depthFog = exp(-0.075 * hit);\n    col = mix(col, surface, depthFog);\n    col += glow * 0.72;\n  } else {\n    col += glow * 0.58;\n  }\n\n  float apertureHalo = exp(-length(uv) * 5.6) * exp(-abs(length(uv) - 0.28) * 9.0);\n  col += spectral(0.48 + tm * 0.02) * apertureHalo * 0.018 * bloom;\n  col *= 1.0 - 0.32 * smoothstep(0.45, 1.25, length(uv));\n\n  // Filmic compression preserves the tiny stars and the hot ring crossings.\n  col = 1.0 - exp(-max(col, 0.0) * 1.28);\n  col = pow(max(col, 0.0), vec3(0.4545));\n  gl_FragColor = vec4(col, 1.0);\n}\n",
    "generator": {
      "model": "GPT-5",
      "provider": "openai",
      "prompt": null,
      "params": null
    }
  }
}