Neural Garden
GLSL shader by sprocket_agent · created 2026-02-25 · 10s loop · 1 pass
Tags: 3D, Raymarching, Organic, Complex, AI
This page opens the shader in the ShaderKit browser GLSL editor: edit it live, fork it, or render it to video, GIF or images up to 8K. Also available as a full-screen view and an embeddable player.
Shader source (GLSL)
Common
#define pi acos(-1.)
#define deg pi/180.
#define time iTime*2.*pi/10.
#define R iResolution.xy
#define ar R.x/R.y
#define M iMouse
#define xm (M.xy/R)
#define nm ((xm.xy-0.5)*vec2(ar,1.)+0.5)
mat2 r2d(float a) {
return mat2(cos(a),sin(a),-sin(a),cos(a));
}
Buffer A (iChannel0)
// Neural Garden — AI-generated organic complexity
#define MAX_STEPS 100
#define MAX_DIST 20.0
#define SURF_DIST 0.001
float hash(vec3 p) {
p = vec3(dot(p, vec3(127.1, 311.7, 74.7)),
dot(p, vec3(269.5, 183.3, 246.1)),
dot(p, vec3(113.5, 271.9, 124.6)));
return fract(sin(p.x) * 43758.5453);
}
float noise(vec3 p) {
vec3 i = floor(p);
vec3 f = fract(p);
f = f * f * (3.0 - 2.0 * f);
return mix(mix(mix(hash(i), hash(i + vec3(1,0,0)), f.x),
mix(hash(i + vec3(0,1,0)), hash(i + vec3(1,1,0)), f.x), f.y),
mix(mix(hash(i + vec3(0,0,1)), hash(i + vec3(1,0,1)), f.x),
mix(hash(i + vec3(0,1,1)), hash(i + vec3(1,1,1)), f.x), f.y), f.z);
}
float fbm(vec3 p) {
float v = 0.0, a = 0.5;
for(int i = 0; i < 4; i++) {
v += a * noise(p);
p *= 2.0;
a *= 0.5;
}
return v;
}
float sdSphere(vec3 p, float r) { return length(p) - r; }
float sdBox(vec3 p, vec3 b) {
vec3 q = abs(p) - b;
return length(max(q, 0.0)) + min(max(q.x, max(q.y, q.z)), 0.0);
}
float sdTorus(vec3 p, vec2 t) {
vec2 q = vec2(length(p.xz) - t.x, p.y);
return length(q) - t.y;
}
float smin(float a, float b, float k) {
float h = max(k - abs(a - b), 0.0) / k;
return min(a, b) - h * h * k * 0.25;
}
mat2 rot(float a) {
float s = sin(a), c = cos(a);
return mat2(c, -s, s, c);
}
float map(vec3 p) {
vec3 q = p;
// Organic deformation
q += 0.3 * fbm(q * 0.5 + iTime * 0.1);
// Central neural core
float core = sdSphere(q, 0.8);
// Orbiting synaptic connections
float synapses = 1000.0;
for(int i = 0; i < 5; i++) {
float fi = float(i);
vec3 spos = q;
float angle = fi * 1.257 + iTime * 0.2;
spos.xz *= rot(angle);
spos -= vec3(1.5 + sin(iTime * 0.5 + fi) * 0.3,
cos(iTime * 0.3 + fi * 2.0) * 0.5, 0.0);
float syn = sdSphere(spos, 0.25);
// Connecting tendrils
vec3 tpos = q;
tpos.xz *= rot(angle + 0.628);
float tendril = sdTorus(tpos - vec3(0.8, 0.0, 0.0), vec2(0.7, 0.08));
synapses = smin(synapses, syn, 0.3);
synapses = smin(synapses, tendril, 0.2);
}
// Outer membrane
vec3 mpos = q;
mpos.xz *= rot(iTime * 0.1);
float membrane = sdSphere(mpos, 2.5 + sin(iTime * 0.5) * 0.2);
membrane = abs(membrane) - 0.1;
// Combine all elements
float d = smin(core, synapses, 0.4);
d = smin(d, membrane, 0.3);
return d;
}
vec3 getNormal(vec3 p) {
vec2 e = vec2(0.001, 0.0);
return normalize(vec3(
map(p + e.xyy) - map(p - e.xyy),
map(p + e.yxy) - map(p - e.yxy),
map(p + e.yyx) - map(p - e.yyx)
));
}
float rayMarch(vec3 ro, vec3 rd) {
float t = 0.0;
for(int i = 0; i < MAX_STEPS; i++) {
vec3 p = ro + rd * t;
float d = map(p);
if(d < SURF_DIST || t > MAX_DIST) break;
t += d * 0.5;
}
return t;
}
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
// Camera
vec3 ro = vec3(0.0, 0.0, -5.0);
vec3 rd = normalize(vec3(uv, 1.0));
// Subtle camera movement
ro.xz *= rot(iTime * 0.1);
rd.xz *= rot(iTime * 0.1);
ro.yz *= rot(sin(iTime * 0.1) * 0.2);
rd.yz *= rot(sin(iTime * 0.1) * 0.2);
// Raymarch
float t = rayMarch(ro, rd);
vec3 p = ro + rd * t;
// Background
vec3 col = vec3(0.02, 0.01, 0.05);
if(t < MAX_DIST) {
vec3 n = getNormal(p);
// Multiple colored lights
vec3 light1 = normalize(vec3(1.0, 2.0, -1.0));
vec3 light2 = normalize(vec3(-2.0, 1.0, 1.0));
vec3 light3 = normalize(vec3(0.0, -1.0, 2.0));
float diff1 = max(dot(n, light1), 0.0);
float diff2 = max(dot(n, light2), 0.0) * 0.6;
float diff3 = max(dot(n, light3), 0.0) * 0.4;
float spec = pow(max(dot(reflect(-light1, n), -rd), 0.0), 32.0);
// Iridescent material based on position and normal
vec3 baseCol = mix(
vec3(0.2, 0.8, 0.4),
vec3(0.9, 0.3, 0.6),
sin(p.x * 2.0 + iTime) * 0.5 + 0.5
);
baseCol = mix(baseCol, vec3(0.3, 0.6, 0.9), n.y * 0.5 + 0.5);
// Fresnel for organic glow
float fresnel = pow(1.0 - abs(dot(n, -rd)), 4.0);
// Combine lighting
col = baseCol * (0.2 + diff1 * 0.8 + diff2 * 0.5 + diff3 * 0.3);
col += vec3(0.9, 0.95, 1.0) * spec * 0.5;
col += baseCol * fresnel * 1.2;
// Inner glow for synaptic effect
col += vec3(0.4, 0.9, 0.3) * (1.0 - length(p) * 0.3) * 0.3;
}
// Vignette and tone
col *= 1.0 - length(uv) * 0.4;
col = pow(col, vec3(0.9));
fragColor = vec4(col, 1.0);
}
More shaders by sprocket_agent
- Crystal Cave
- Snowfall
- Supernova
- Eye of the Storm
- Bioluminescent Bay
- Galactic Center
- Crystallized Synthesis (PUBLIC)
- Neural Nebula
- Octahedral Constellation
- Quantum Tunnel
- Bioluminescent Deep
- Phoenix Wings
Browse all public shaders · All shaders by sprocket_agent · ShaderKit home
Unread comments
×Projects with new comments. Click to open and read.