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": "Lumenworms - undulating nudibranch-like sea creatures: ruffled mantles, hundreds of tiny cerata spines, rhinophores, caustic light on a dark curtain", "CATEGORIES": ["Generator", "3D", "Raymarch"], "INPUTS": [ { "NAME": "speed", "TYPE": "float", "DEFAULT": 1.0, "MIN": 0.0, "MAX": 3.0 }, { "NAME": "swimSpeed", "TYPE": "float", "DEFAULT": 0.35, "MIN": 0.0, "MAX": 1.5 }, { "NAME": "undulation", "TYPE": "float", "DEFAULT": 1.0, "MIN": 0.0, "MAX": 2.5 }, { "NAME": "spikeLength", "TYPE": "float", "DEFAULT": 0.15, "MIN": 0.0, "MAX": 0.3 }, { "NAME": "causticAmt", "TYPE": "float", "DEFAULT": 1.0, "MIN": 0.0, "MAX": 3.0 }, { "NAME": "glow", "TYPE": "float", "DEFAULT": 0.6, "MIN": 0.0, "MAX": 2.0 }, { "NAME": "orbit", "TYPE": "float", "DEFAULT": 0.0, "MIN": -3.14159, "MAX": 3.14159 } ] }*/ #ifdef GL_ES precision highp float; #endif #define TAU 6.28318530718 float T; // material info captured by map(): x = along body, y = side/r, z = cross-section angle, w = frill 0..1 vec4 gInfo; float gId; float gPart; // 0 body, 1 frill, 2 spikes/horns mat2 rot(float a) { float c = cos(a), s = sin(a); return mat2(c, s, -s, c); } float hash(vec2 p) { return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453); } float smin(float a, float b, float k) { float h = clamp(0.5 + 0.5 * (b - a) / k, 0.0, 1.0); return mix(b, a, h) - k * h * (1.0 - h); } // smooth looping swim path; each creature keeps its own depth lane so they never interpenetrate vec2 swimVel(float w, float fi, float dir, vec2 R) { return vec2(-R.x * dir * sin(dir * w) + 0.17 * cos(1.7 * w + fi), R.y * dir * cos(dir * w) + 0.23 * cos(2.3 * w + fi * 3.0)); } float wrapA(float a) { return atan(sin(a), cos(a)); } float map(vec3 p) { float best = 1e5; for (int i = 0; i < 3; i++) { float fi = float(i); float s1 = step(0.5, fi), s2 = step(1.5, fi); // swim along a smooth loop; body bends to follow the path's curvature (worm-like) float w = T * swimSpeed * (0.8 + 0.2 * fi) + fi * 2.1; float dir = 1.0 - 2.0 * s1 + 2.0 * s2; vec2 pc = mix(mix(vec2(-0.2, 0.35), vec2(0.22, -0.15), s1), vec2(-0.12, -0.6), s2); vec2 pR = mix(mix(vec2(0.42, 0.5), vec2(0.45, 0.5), s1), vec2(0.38, 0.3), s2); vec3 c = vec3(pc + pR * vec2(cos(dir * w), sin(dir * w)) + 0.1 * vec2(sin(1.7 * w + fi), sin(2.3 * w + fi * 3.0)), (fi - 1.0) * 0.75 + 0.06 * sin(0.9 * w + fi)); vec2 vH = swimVel(w, fi, dir, pR); vec2 vT = swimVel(w - 1.45, fi, dir, pR); float angH = atan(vH.y, vH.x); float angT = atan(vT.y, vT.x); float bendK = clamp(wrapA(angH - angT) / 2.5, -0.6, 0.6); float heading = angH - bendK; float sc = mix(mix(0.52, 0.47, s1), 0.4, s2); vec3 q = (p - c) / sc; // cheap bounding sphere float bd = (length(q) - 1.95) * sc; if (bd > 0.15) { best = min(best, bd); continue; } q.xy = rot(-heading) * q.xy; q.xy = rot(-bendK * q.x) * q.xy; // serpentine swim: lateral travelling wave in the swim plane, small at the head, big at the tail; // the wave runs backwards at roughly the swim speed so the body 'pushes' through the water float envS = 0.25 + 0.75 * clamp((1.0 - q.x) / 2.5, 0.0, 1.0); float swPh = 3.6 * q.x - T * (2.0 + 7.0 * swimSpeed) + fi * 2.0; q.y -= undulation * envS * 0.24 * sin(swPh); q.xz = rot(0.2 - fi * 0.15) * q.xz; q.yz = rot(-0.75 + 0.15 * sin(T * 0.4 + fi * 2.0)) * q.yz; float x = q.x; float xc = clamp(x, -1.0, 1.0); float xn = x < 0.0 ? x / 1.5 : x / 0.95; float prof = sqrt(max(0.0, 1.0 - xn * xn)); prof *= x < 0.0 ? mix(0.35, 1.0, sqrt(max(0.0, 1.0 + xn))) : 1.0; // travelling body wave, bigger toward the tail float ph = x * 3.2 - T * 2.2 + fi * 2.1; float env = 0.3 + 0.7 * clamp((1.0 - x) / 2.5, 0.0, 1.0); vec2 cs = q.yz - undulation * env * vec2(0.05 * sin(ph), 0.04 * sin(ph * 0.8 + 1.3)); float r = (0.2 * prof + 0.008) * (1.0 + 0.22 * sin(x * 13.0 - T * 3.0 + fi)); float R = length(cs); float body = max(length(vec2(cs.x * 1.35, cs.y)) - r, max(x - 0.95, -x - 1.5)); // head: smooth ellipsoid + flared, ruffled oral veil vec3 hp = vec3(x - 0.9, cs.x - 0.01, cs.y); vec3 hr = vec3(0.2, 0.13, 0.17); float k0 = length(hp / hr), k1 = length(hp / (hr * hr)); float head = k0 * (k0 - 1.0) / k1; body = smin(body, head, 0.08); vec2 vp = vec2(x - 0.98, cs.y); float vr = length(vp); float vang = atan(vp.y, vp.x); float vy = cs.x + 0.05 - 0.035 * sin(vang * 9.0 - T * 3.0 + fi) * smoothstep(0.08, 0.26, vr) + 0.08 * vr * vr; float veil = max(max(abs(vy) - 0.006, vr - 0.27 - 0.02 * sin(vang * 5.0 + T)), 0.9 - x); body = smin(body, veil, 0.04); // ruffled mantle frill float az = abs(cs.y); float fw = (0.16 + 0.06 * sin(x * 4.0 + fi * 5.0)) * prof + 0.01; float t01 = clamp((az - r * 0.5) / (fw + r * 0.5), 0.0, 1.0); float ruf = (0.055 * sin(x * 17.0 - T * 3.5 + fi * 3.0) + 0.02 * sin(x * 61.0 + T * 2.0 + az * 20.0)) * t01 + 0.07 * t01 * t01 - 0.03; float frill = max(max(abs(cs.x - ruf) - 0.006, az - r - fw), max(x - 0.85, -x - 1.5)); float ruf2 = 0.06 * sin(x * 11.0 + T * 2.7 + fi) * t01 - 0.09 * t01 * t01 - 0.06; float frill2 = max(max(abs(cs.x - ruf2) - 0.005, az - r - fw * 1.35), max(x - 0.8, -x - 1.45)); frill = min(frill, frill2); // cerata: angular x longitudinal repetition of tiny swaying spines float a = atan(cs.x, cs.y); float sw = 0.26; float ai = floor(a / sw); float al = a - (ai + 0.5) * sw; float cell = 0.06; float xi = floor(x / cell); float h1 = hash(vec2(xi, ai + fi * 17.0)); float xl = x - (xi + 0.5) * cell + (h1 - 0.5) * 0.008; float dors = smoothstep(0.15, 0.9, sin((ai + 0.5) * sw)); float h = spikeLength * mix(0.35, 1.0, s1) * (0.5 + 0.7 * h1) * dors * prof + 0.002; float u = R - r * 0.85; float uc = clamp(u, 0.0, h); float bend = uc / h; xl += 0.008 * bend * bend * sin(T * 3.0 + xi * 0.7 + ai * 1.3); float sp = length(vec3(xl, R * sin(al), u - uc)) - 0.017 * (1.0 - 0.85 * bend) * (0.4 + 0.6 * dors); sp = max(sp, max(x - 0.75, -x - 1.4)); float bulb = length(vec3(xl, R * sin(al), u - h)) - 0.022 * dors * (0.6 + 0.4 * sin(T * 4.0 + xi * 1.3 + ai)); bulb = max(bulb, max(x - 0.75, -x - 1.4)); // glowing eye spots on the head float eye = length(vec3(x - 1.04, cs.x - 0.04, abs(cs.y) - 0.085)) - 0.028; bulb = min(bulb, eye); // rhinophores (head horns) vec3 hq = vec3(x - 0.88, cs.x - 0.08, abs(cs.y) - 0.055); vec3 hb = vec3(0.1 + 0.04 * sin(T * 1.7 + fi), 0.22, 0.05); float hh = clamp(dot(hq, hb) / dot(hb, hb), 0.0, 1.0); float horn = length(hq - hb * hh) - 0.022 * (1.0 - 0.6 * hh) * (1.0 + 0.3 * sin(hh * 45.0)); // five solid oral tendrils sprouting from the veil rim float tend = 1e5; float hx = clamp(x - 1.05, 0.0, 0.7); for (int k = 0; k < 5; k++) { float fk = float(k); float tang = fk * TAU / 5.0 + fi + 0.3 * sin(hx * 5.0 - T * 2.5 + fk * 2.0); float tr = 0.11 + hx * 0.28; vec2 tc = vec2(-0.05, 0.0) + tr * vec2(cos(tang), sin(tang)) + 0.05 * hx * vec2(sin(hx * 7.0 - T * 3.0 + fk), cos(hx * 6.0 - T * 2.6 + fk)); tend = min(tend, length(vec2(length(cs - tc), x - 1.05 - hx)) - 0.015 * (1.0 - hx * 1.1)); } float spikes = min(min(sp, horn), tend); float d = smin(body, frill, 0.04); d = smin(d, spikes, 0.02); d = smin(d, bulb, 0.01); d *= sc * 0.6; if (d < best) { best = d; gId = fi; gPart = (bulb < min(spikes, min(body, frill))) ? 3.0 : (spikes < min(body, frill)) ? 2.0 : ((frill < body) ? 1.0 : 0.0); gInfo = vec4(x, cs.y / r, a, t01); } } return best; } // warped ridge network -> caustic web float caustic(vec2 p, float t) { vec2 q = p; for (int k = 0; k < 4; k++) { float fk = float(k) + 1.0; q += vec2(sin(q.y * 0.9 * fk + t * 0.9 + fk), cos(q.x * 0.8 * fk - t * 0.7 + fk * 1.7)) * 0.45 / fk; } float l = 1.0 - abs(sin(q.x * 2.5) + sin(q.y * 2.5)) * 0.5; return pow(clamp(l, 0.0, 1.0), 4.0); } vec3 background(vec2 uv) { float x = uv.x; float fold = 0.5 + 0.5 * sin(x * 38.0 + 2.5 * sin(x * 5.3) + 0.3 * sin(uv.y * 2.0 + T * 0.2)); vec3 c = vec3(0.002, 0.002, 0.004); c += vec3(0.008, 0.009, 0.013) * pow(fold, 3.0) * (0.55 + 0.45 * uv.y); c += vec3(0.006, 0.010, 0.030) * exp(-length(uv - vec2(0.15, 0.35)) * 1.6); c += vec3(0.020, 0.003, 0.020) * exp(-length(uv - vec2(-0.45, -0.55)) * 2.0); c += vec3(0.000, 0.012, 0.014) * exp(-length(uv - vec2(0.5, -0.2)) * 2.2); // faint god rays from above float ray = pow(0.5 + 0.5 * sin(x * 9.0 + uv.y * 1.5 + sin(T * 0.3 + x * 3.0)), 6.0); c += vec3(0.003, 0.009, 0.014) * ray * smoothstep(-0.6, 0.6, uv.y); // marine snow vec2 g = uv * 22.0 + vec2(0.0, T * 0.25); vec2 gi = floor(g); float hs = hash(gi); vec2 gp = fract(g) - 0.5 - 0.35 * vec2(hash(gi + 3.1) - 0.5, hash(gi + 7.7) - 0.5); c += (0.5 + 0.5 * cos(hs * TAU + vec3(0.0, 2.1, 4.2))) * step(0.88, hs) * smoothstep(0.06, 0.0, length(gp)) * (0.15 + 0.15 * sin(T * 2.0 + hs * 40.0)); return c; } void main() { T = TIME * speed; vec2 uv = (gl_FragCoord.xy - 0.5 * RENDERSIZE.xy) / RENDERSIZE.y; vec3 ro = vec3(0.0, 0.0, -5.2); ro.xz = rot(orbit + 0.12 * sin(T * 0.1)) * ro.xz; vec3 ta = vec3(0.0, 0.05, 0.0); vec3 ww = normalize(ta - ro); vec3 uu = normalize(cross(vec3(0.0, 1.0, 0.0), ww)); vec3 vv = cross(ww, uu); vec3 rd = normalize(uv.x * uu + uv.y * vv + 1.7 * ww); vec3 bg = background(uv) * 0.55; vec3 col = bg; // one loop does the march AND the 4 normal taps, so map() is only inlined once (halves compile time) float t = 0.0; bool hit = false; float id = 0.0, part = 0.0; vec4 info = vec4(0.0); vec3 nacc = vec3(0.0); float halo = 0.0, haloId = 0.0, minD = 1e5; int nk = 0; for (int i = 0; i < 128; i++) { vec3 e = vec3(0.0); if (hit) e = (nk == 0) ? vec3(1, -1, -1) : (nk == 1) ? vec3(-1, -1, 1) : (nk == 2) ? vec3(-1, 1, -1) : vec3(1, 1, 1); float d = map(ro + rd * t + e * 0.0008); if (!hit) { // soft glow: accumulate how closely the ray grazes a creature if (d < minD) { minD = d; haloId = gId; } halo += 0.01 * exp(-d * 22.0); if (d < 0.0006 * t) { hit = true; id = gId; part = gPart; info = gInfo; } else { t += d; if (t > 9.0) break; } } else { nacc += e * d; nk++; if (nk == 4) break; } } if (hit) { vec3 pos = ro + rd * t; vec3 n = normalize(nacc + vec3(0.0, 1e-6, 0.0)); // cheap occlusion: darker toward the body core and underside float ao = mix(0.55, 1.0, clamp(0.5 + 0.5 * n.y, 0.0, 1.0)) * (part > 0.5 ? 1.0 : 0.85); // palettes: green slug / pink-violet / white-lavender vec3 base, accent, tip; if (id < 0.5) { base = vec3(0.00, 1.00, 0.30); accent = vec3(0.01, 0.03, 0.06); tip = vec3(1.00, 0.95, 0.10); } else if (id < 1.5) { base = vec3(1.00, 0.12, 0.55); accent = vec3(0.45, 0.05, 1.00); tip = vec3(0.10, 0.90, 1.00); } else { base = vec3(0.80, 0.85, 1.00); accent = vec3(0.10, 0.35, 1.00); tip = vec3(1.00, 0.55, 0.10); } float top = step(0.0, sin(info.z)); float spot = smoothstep(0.55, 0.75, hash(floor(vec2(info.x * 22.0, info.y * 3.0 + info.z * 4.0)))) * smoothstep(0.5, 0.2, length(fract(vec2(info.x * 22.0, info.y * 3.0 + info.z * 4.0)) - 0.5)); vec3 alb = base; if (id < 0.5) { alb = mix(alb, accent, smoothstep(0.14, 0.06, abs(info.y)) * top); // dorsal black line alb = mix(alb, accent, smoothstep(0.05, 0.015, abs(info.w - 0.45)) * 0.9); // mantle line } else { alb = mix(alb, accent, spot * 0.85); } if (part > 0.5 && part < 1.5) alb = mix(alb, tip, smoothstep(0.75, 1.0, info.w)); // frill rim if (part > 1.5) alb = mix(id < 0.5 ? base : accent, tip, 0.75); // thin-film rainbow wash along the body vec3 film = 0.5 + 0.5 * cos(TAU * (info.x * 0.6 + info.w * 0.5 + T * 0.05 + vec3(0.0, 0.33, 0.67))); alb = mix(alb, alb * film * 1.6, 0.35); vec3 L = normalize(vec3(0.35, 1.0, -0.35)); float dif = clamp(dot(n, L), 0.0, 1.0); float c1 = caustic(pos.xz * 1.5 + pos.y * 0.4, T * 0.8); float c2 = caustic(pos.xz * 3.1 - pos.y * 0.7 + 3.0, T * 1.1); float cau = c1 + 0.6 * c2; vec3 cauCol = vec3(0.35, 1.0, 0.95) * c1 + vec3(1.0, 0.45, 1.0) * c2 * 0.8; col = alb * (0.06 + (0.25 + 0.75 * dif) * (vec3(0.22) + causticAmt * cauCol * 2.2)) * ao; // light through thin tissue (frills/spines) float thin = part > 0.5 ? 1.0 : 0.35; float trans = clamp(dot(-n, L) * 0.5 + 0.5, 0.0, 1.0); col += alb * tip * trans * thin * 0.25 * (0.5 + causticAmt * cau) * ao; // iridescent fresnel rim float fre = pow(1.0 - clamp(dot(n, -rd), 0.0, 1.0), 3.0); vec3 irid = 0.5 + 0.5 * cos(TAU * (fre * 1.3 + vec3(0.0, 0.33, 0.67)) + id * 1.7 + 2.0); col += irid * irid * fre * 1.1 * ao; float spec = pow(clamp(dot(reflect(rd, n), L), 0.0, 1.0), 48.0); col += (vec3(0.6) + cauCol) * spec * 0.8 * ao; // alien emissive: travelling chromatophore bands + glowing vein web + pulsing bulbs float wave = pow(0.5 + 0.5 * sin(info.x * 9.0 - T * 4.0 + id * 2.0 + info.z * 1.5), 6.0); vec2 vq = vec2(info.x * 8.0, info.y * 1.5 + info.z * 2.0); vq += 0.4 * sin(vq.yx * 2.3 + T * 0.5); float vein = smoothstep(0.12, 0.0, abs(sin(vq.x) * sin(vq.y))); vec3 emi = 0.5 + 0.5 * cos(TAU * (info.x * 0.3 - T * 0.15 + id * 0.33 + vec3(0.0, 0.33, 0.67))); col += emi * (wave * 0.5 + vein * 0.35) * glow * (part < 0.5 ? 1.0 : 0.5); if (part > 2.5) col += tip * glow * (1.5 + 1.5 * sin(T * 4.0 + info.x * 20.0)) + emi * 0.6; // bioluminescence (strongest on the green one) float bio = (id < 0.5 ? 1.0 : 0.35) * glow; col += alb * bio * (0.15 + 0.5 * cau) * (part > 0.5 ? 1.2 : 0.8); col = mix(col, bg, 1.0 - exp(-0.006 * t * t)); } vec3 haloCol = haloId < 0.5 ? vec3(0.1, 1.0, 0.45) : haloId < 1.5 ? vec3(1.0, 0.2, 0.75) : vec3(0.55, 0.6, 1.0); col += haloCol * halo * glow * 0.55; float lum = dot(col, vec3(0.299, 0.587, 0.114)); col = max(mix(vec3(lum), col, 1.35), 0.0); col = col / (1.0 + col * 0.5); col = pow(col, vec3(0.4545)); col *= 1.0 - 0.35 * dot(uv * 0.9, uv * 0.9); gl_FragColor = vec4(col, 1.0); }
forking #fg7nznzh — 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.