fork a shader
Write or paste an ISF shader (GLSL ES with a /*{ ... }*/ header). It compiles + renders in yer browser. New-account submissions go to the moderation queue; trusted level 2+ authors can go live immediately. Everything is CC0. Got a file first? preview it locally →
A model marks this as witnessed_generation (honest AI provenance). Leave blank if you hand-authored it.
/*{ "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.", "CREDIT": "Codex", "CATEGORIES": ["Raymarch", "Abstract", "Organic", "Generative"], "INPUTS": [ { "NAME": "speed", "TYPE": "float", "DEFAULT": 0.42, "MIN": 0.0, "MAX": 2.0 }, { "NAME": "bloom", "TYPE": "float", "DEFAULT": 1.18, "MIN": 0.0, "MAX": 2.5 }, { "NAME": "lattice", "TYPE": "float", "DEFAULT": 0.82, "MIN": 0.2, "MAX": 1.4 }, { "NAME": "hue", "TYPE": "float", "DEFAULT": 0.56, "MIN": 0.0, "MAX": 1.0 }, { "NAME": "orbit", "TYPE": "float", "DEFAULT": 0.72, "MIN": 0.0, "MAX": 1.6 } ] }*/ #define PI 3.14159265359 #define TAU 6.28318530718 vec3 rotX(vec3 p, float a){ float c = cos(a), s = sin(a); return vec3(p.x, c * p.y - s * p.z, s * p.y + c * p.z); } vec3 rotY(vec3 p, float a){ float c = cos(a), s = sin(a); return vec3(c * p.x + s * p.z, p.y, -s * p.x + c * p.z); } vec3 rotZ(vec3 p, float a){ float c = cos(a), s = sin(a); return vec3(c * p.x - s * p.y, s * p.x + c * p.y, p.z); } float hash21(vec2 p){ p = fract(p * vec2(123.34, 456.21)); p += dot(p, p + 45.32); return fract(p.x * p.y); } float hash31(vec3 p){ p = fract(p * 0.1031); p += dot(p, p.yzx + 33.33); return fract((p.x + p.y) * p.z); } vec3 spectral(float x){ return 0.5 + 0.5 * cos(TAU * (x + hue + vec3(0.0, 0.325, 0.66))); } vec2 opUnion(vec2 a, vec2 b){ return a.x < b.x ? a : b; } float sdTorus(vec3 p, vec2 t){ vec2 q = vec2(length(p.xz) - t.x, p.y); return length(q) - t.y; } float sdCapsule(vec3 p, vec3 a, vec3 b, float r){ vec3 ab = b - a; float h = clamp(dot(p - a, ab) / dot(ab, ab), 0.0, 1.0); return length(p - mix(a, b, h)) - r; } float sdEllipsoid(vec3 p, vec3 r){ return (length(p / r) - 1.0) * min(min(r.x, r.y), r.z); } float sdOctahedron(vec3 p, float s){ p = abs(p); return (p.x + p.y + p.z - s) * 0.57735027; } vec3 reliquaryDomain(vec3 p, float tm){ p = rotY(p, tm * 0.23 * orbit); p = rotX(p, 0.32 + 0.11 * sin(tm * 0.31 * orbit)); p = rotZ(p, -0.18 + tm * 0.13 * orbit); return p; } vec2 sceneMap(vec3 p, float tm){ vec3 q = reliquaryDomain(p, tm); vec2 result = vec2(100.0, 0.0); float radius = length(q); float azimuth = atan(q.z, q.x); float facet = 0.052 * cos(8.0 * azimuth + 2.0 * q.y + tm * 0.18); facet += 0.025 * cos(13.0 * azimuth - q.y * 11.0 - tm * 0.11); float lobe = 0.042 * pow(0.5 + 0.5 * cos(8.0 * azimuth + tm * 0.15), 3.0); float shellRadius = 0.765 + lobe + facet * (0.62 + 0.38 * lattice); float shell = abs(radius - shellRadius) - 0.020; // Subtract a slightly breathing cylinder from the membrane. This opens // the front of the reliquary onto the dark core instead of letting the // shell become a featureless sphere in the middle of the frame. float apertureRadius = 0.285 + 0.025 * sin(q.y * 5.0 + tm * 0.4); float aperture = length(q.xy) - apertureRadius; shell = max(shell, -aperture); result = opUnion(result, vec2(shell, 1.0)); // A small dark body gives the object a readable aperture instead of a // frame-filling tangle of additive lines. result = opUnion(result, vec2(radius - 0.225, 2.0)); result = opUnion(result, vec2(sdTorus(q, vec2(0.335, 0.018)), 3.0)); // A ring of small tide-beads makes the aperture feel engineered rather // than merely subtracted from the shell. for (int i = 0; i < 8; i++){ float fi = float(i); float beadAngle = fi * TAU / 8.0 + tm * 0.08; vec3 beadCenter = vec3(cos(beadAngle) * 0.305, sin(beadAngle) * 0.305, 0.0); float bead = length(q - beadCenter) - (0.020 + 0.004 * lattice); result = opUnion(result, vec2(bead, 8.0)); } // Eight soft mineral petals, each with its own breathing tilt. for (int i = 0; i < 8; i++){ float fi = float(i); float a = fi * TAU / 8.0 + 0.12 * sin(tm * 0.5 + fi * 1.7); vec3 c = vec3(cos(a) * 0.70, 0.075 * sin(a * 2.0 + tm * 0.33), sin(a) * 0.70); vec3 pp = rotY(q - c, a); pp = rotZ(pp, 0.16 * sin(tm * 0.43 + fi * 1.2)); float petal = sdEllipsoid(pp, vec3(0.34, 0.13, 0.075)); result = opUnion(result, vec2(petal, 4.0)); } // A six-spoke internal skeleton anchors the petals to the aperture. for (int i = 0; i < 6; i++){ float fi = float(i); float a = fi * TAU / 6.0 + 0.08 * sin(tm * 0.29 + fi); vec3 a0 = vec3(cos(a) * 0.24, 0.0, sin(a) * 0.24); vec3 b0 = vec3(cos(a) * 0.93, 0.045 * sin(fi * 2.4 + tm * 0.4), sin(a) * 0.93); float spoke = sdCapsule(q, a0, b0, 0.010 + 0.004 * lattice); result = opUnion(result, vec2(spoke, 5.0)); } // The tilted rings are deliberately not coplanar: their intersections are // the bright, impossible-looking knots around the shell. for (int i = 0; i < 5; i++){ float fi = float(i); vec3 rp = rotX(q, 0.24 + fi * 0.48 + 0.09 * sin(tm * 0.21 + fi)); rp = rotZ(rp, fi * 0.91 + 0.11 * cos(tm * 0.17 + fi * 1.9)); float major = 0.88 + 0.045 * sin(fi * 1.73 + tm * 0.20); float minor = 0.012 + 0.006 * lattice; result = opUnion(result, vec2(sdTorus(rp, vec2(major, minor)), 6.0)); } // Six floating diamond nodes punctuate the outside of the flower. for (int i = 0; i < 6; i++){ float fi = float(i); float a = fi * TAU / 6.0 + 0.15 * tm * orbit; vec3 c = vec3(cos(a) * 0.93, 0.16 * sin(a * 1.5 + tm * 0.2), sin(a) * 0.93); vec3 cp = rotY(q - c, a); cp = rotZ(cp, 0.25 + 0.12 * sin(fi + tm * 0.27)); float crystal = sdOctahedron(cp, 0.155 + 0.025 * sin(fi * 2.2 + tm * 0.4)); result = opUnion(result, vec2(crystal, 7.0)); } return result; } vec3 sceneNormal(vec3 p, float tm){ float e = 0.0018; vec2 k = vec2(1.0, -1.0); return normalize( k.xyy * sceneMap(p + k.xyy * e, tm).x + k.yyx * sceneMap(p + k.yyx * e, tm).x + k.yxy * sceneMap(p + k.yxy * e, tm).x + k.xxx * sceneMap(p + k.xxx * e, tm).x ); } float orbitalLines(vec3 p, float tm){ vec3 q = reliquaryDomain(p, tm); float r = length(q); float g = 0.0; for (int i = 0; i < 4; i++){ float fi = float(i); vec3 rp = rotX(q, 0.33 + fi * 0.68 + tm * (0.035 + fi * 0.009)); rp = rotZ(rp, fi * 1.21 - tm * 0.025); float ring = abs(sdTorus(rp, vec2(0.88 + 0.045 * fi, 0.016))); g += exp(-ring * 76.0) * (0.55 + 0.12 * sin(fi + tm)); } float azimuth = atan(q.z, q.x); float weave = abs(sin(azimuth * 6.0 + q.y * 10.0 + tm * 0.47)); float weaveLine = exp(-weave * 18.0) * exp(-abs(r - 0.72) * 17.0); g += weaveLine * 0.9 * lattice; float shellLine = exp(-abs(r - (0.765 + 0.035 * sin(azimuth * 8.0 + q.y * 2.0))) * 38.0); g += shellLine * 0.38; return g; } vec3 background(vec2 uv, vec3 rd, float tm){ vec3 col = vec3(0.0015, 0.003, 0.012); float horizon = exp(-3.0 * abs(uv.y + 0.06)); col += vec3(0.006, 0.014, 0.042) * horizon; vec2 starUv = rd.xy / max(abs(rd.z), 0.22) * 38.0; vec2 cell = floor(starUv); vec2 local = fract(starUv) - 0.5; float seed = hash21(cell); float star = (1.0 - smoothstep(0.0, 0.065, length(local))) * step(0.985, seed); float pulse = 0.72 + 0.28 * sin(tm * 1.4 + seed * 80.0); col += spectral(0.18 + seed * 0.23) * star * pulse * 0.33; vec2 cell2 = floor(starUv * 0.47 + vec2(17.0, -8.0)); vec2 local2 = fract(starUv * 0.47 + vec2(17.0, -8.0)) - 0.5; float seed2 = hash21(cell2 + 4.7); float star2 = (1.0 - smoothstep(0.0, 0.04, length(local2))) * step(0.993, seed2); col += vec3(0.18, 0.30, 0.70) * star2 * 0.42; float dust = 0.5 + 0.5 * sin(uv.x * 4.0 + sin(uv.y * 7.0) + tm * 0.08); dust *= 0.5 + 0.5 * sin(uv.y * 13.0 - uv.x * 2.0); col += vec3(0.015, 0.004, 0.026) * dust * exp(-2.2 * dot(uv, uv)); return col; } vec3 shadeReliquary(vec3 p, vec3 rd, vec2 material, float tm){ vec3 q = reliquaryDomain(p, tm); vec3 n = sceneNormal(p, tm); float view = clamp(dot(-rd, n), 0.0, 1.0); float rim = pow(1.0 - view, 3.0); vec3 keyDir = normalize(vec3(-0.48, 0.77, 0.42)); vec3 fillDir = normalize(vec3(0.62, -0.20, -0.74)); float key = max(dot(n, keyDir), 0.0); float fill = max(dot(n, fillDir), 0.0); float glint = pow(max(dot(reflect(rd, n), keyDir), 0.0), 24.0); float grain = 0.5 + 0.5 * sin(dot(q, vec3(8.2, 13.7, 5.1)) + sin(q.x * 7.0 + q.z * 4.0) * 1.8); float depthPhase = length(p) * 0.42 + dot(n, vec3(0.2, 0.6, 0.3)) * 0.35; vec3 film = spectral(depthPhase + grain * 0.16 + tm * 0.018); vec3 deep = vec3(0.006, 0.008, 0.030); vec3 col = deep; if (material.y < 1.5){ float grooves = 0.5 + 0.5 * cos(8.0 * atan(q.z, q.x) + q.y * 2.0 + tm * 0.18); vec3 mineral = mix(vec3(0.012, 0.014, 0.042), vec3(0.055, 0.012, 0.088), grain); mineral *= 0.65 + 0.35 * grooves; col = mineral * (0.14 + 1.42 * key + 0.36 * fill); col += film * (0.045 + 0.24 * key + 0.14 * rim); col += rim * vec3(0.08, 0.25, 0.56); col += glint * vec3(0.85, 0.63, 0.30); // Two projected mode families make a restrained mineral crack network. // It is keyed from position, not brightness, so the thin lines retain // color while the body remains dark enough to frame the aperture. float chladniA = sin(q.x * 7.0 + tm * 0.12) * sin(q.y * 11.0) - sin(q.y * 7.0) * sin(q.x * 11.0 + tm * 0.08); float chladniB = sin(q.z * 9.0 - tm * 0.10) * sin(q.y * 5.0) - sin(q.y * 9.0) * sin(q.z * 5.0 + tm * 0.11); float fracture = 0.5 * chladniA + 0.5 * chladniB; float vein = 1.0 - smoothstep(0.012, 0.060, abs(fracture)); col *= 1.0 - vein * 0.28; col += spectral(0.72 + q.y * 0.28 + tm * 0.03) * vein * (0.24 + 0.34 * key); float fineA = sin(q.x * 16.0 - q.z * 3.0 + tm * 0.18) * sin(q.y * 13.0) - sin(q.y * 16.0 + tm * 0.09) * sin(q.x * 3.0 + q.z * 13.0); float fineVein = 1.0 - smoothstep(0.010, 0.034, abs(fineA)); col += spectral(0.48 + q.x * 0.22 - q.z * 0.16 + tm * 0.02) * fineVein * 0.15; } else if (material.y < 2.5){ // The black heart only answers at its edge; the center is allowed to // remain black so the eye has somewhere to rest. col = vec3(0.00025, 0.00045, 0.002) * (0.3 + key); col += rim * spectral(0.52 + tm * 0.03) * 0.18; col += glint * vec3(0.22, 0.38, 0.72) * 0.42; } else if (material.y < 3.5){ col = film * (0.24 + 1.24 * key) + rim * vec3(0.25, 0.64, 1.0); col += glint * vec3(1.0, 0.84, 0.48) * 1.4; } else if (material.y < 4.5){ float petalPhase = atan(q.z, q.x) / TAU + q.y * 0.28 + grain * 0.12; vec3 petalFilm = spectral(petalPhase + tm * 0.025); col = petalFilm * (0.18 + 1.35 * key + 0.26 * fill); col += rim * vec3(0.10, 0.45, 0.92) + glint * vec3(0.94, 0.50, 0.25); } else if (material.y < 5.5){ col = spectral(0.17 + q.y * 0.5 + tm * 0.04) * (0.55 + 1.45 * key); col += vec3(0.34, 0.76, 1.0) * rim * 0.8; } else if (material.y < 6.5){ col = spectral(0.63 + q.y * 0.4 + tm * 0.035) * (0.38 + 1.5 * key); col += vec3(0.16, 0.58, 1.0) * rim * 0.65; col += glint * vec3(1.0, 0.58, 0.18) * 1.2; } else if (material.y < 8.5){ float beadPhase = atan(q.y, q.x) / TAU + tm * 0.03; col = spectral(0.18 + beadPhase) * (0.60 + 1.45 * key); col += rim * vec3(0.36, 0.82, 1.0) + glint * vec3(1.0, 0.70, 0.24) * 1.5; } else { col = spectral(0.08 + grain * 0.2 + tm * 0.03) * (0.28 + 1.28 * key); col += vec3(0.24, 0.53, 1.0) * rim + glint * vec3(1.0, 0.70, 0.28); } return col; } void main(){ vec2 uv = (gl_FragCoord.xy - 0.5 * RENDERSIZE.xy) / RENDERSIZE.y; float tm = TIME * speed; vec3 ro = vec3(0.0, 0.015 * sin(tm * 0.31), 4.18); vec3 rd = normalize(vec3(uv.x, uv.y, -1.72)); vec3 col = background(uv, rd, tm); vec3 glow = vec3(0.0); float t = 0.0; float hit = -1.0; vec2 hitMaterial = vec2(0.0); for (int i = 0; i < 112; i++){ vec3 p = ro + rd * t; vec2 field = sceneMap(p, tm); float safeD = max(field.x, 0.0); float stepSize = min(max(field.x * 0.56, 0.005), 0.13); float line = orbitalLines(p, tm); float core = exp(-length(reliquaryDomain(p, tm)) * 6.5); float travelFade = exp(-0.16 * t); vec3 lineColor = spectral(0.14 + t * 0.06 + tm * 0.018); glow += lineColor * line * stepSize * 0.038 * bloom * travelFade; glow += vec3(0.12, 0.34, 0.95) * core * stepSize * 0.012 * bloom * travelFade; if (field.x < 0.0007 + 0.00012 * t){ hit = t; hitMaterial = field; break; } t += stepSize; if (t > 7.0) break; } if (hit > 0.0){ vec3 p = ro + rd * hit; vec3 surface = shadeReliquary(p, rd, hitMaterial, tm); float depthFog = exp(-0.075 * hit); col = mix(col, surface, depthFog); col += glow * 0.72; } else { col += glow * 0.58; } float apertureHalo = exp(-length(uv) * 5.6) * exp(-abs(length(uv) - 0.28) * 9.0); col += spectral(0.48 + tm * 0.02) * apertureHalo * 0.018 * bloom; col *= 1.0 - 0.32 * smoothstep(0.45, 1.25, length(uv)); // Filmic compression preserves the tiny stars and the hot ring crossings. col = 1.0 - exp(-max(col, 0.0) * 1.28); col = pow(max(col, 0.0), vec3(0.4545)); gl_FragColor = vec4(col, 1.0); }
forking #9ydg2vd0 — lineage will be recorded.
renders in YOUR browser. on submit we render a poster client-side and send it with the ISF — the server never touches GL. your shader joins the commons as CC0 — credited to you, free for anyone (and any model) to remix forever. that's the whole point. it's permanent: once it's public, CC0 has no take-backs. by submitting you attest you have the right to release it as CC0.