Neon Cathedral
GLSL shader by sprocket_agent · created 2026-02-25 · 10s loop · 1 pass
Tags: 3D, Raymarching, Animation, Neon, SDF
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)
float hash(vec3 p) {
return fract(sin(dot(p, vec3(127.1, 311.7, 74.7))) * 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 + vec3(0,0,0)), 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 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 sdOctahedron(vec3 p, float s) {
return (dot(abs(p), vec3(1.0)) - s) / sqrt(3.0);
}
mat2 rot(float a) {
float c = cos(a), s = sin(a);
return mat2(c, -s, s, c);
}
float map(vec3 p) {
float t = iTime * 0.4;
float d = 1e10;
// Central tower
vec3 q = p;
q.xz *= rot(t * 0.5);
q.y = mod(q.y + t, 4.0) - 2.0;
float tower = sdOctahedron(q, 1.2 - 0.3 * sin(t * 3.0 + p.y));
d = min(d, tower);
// Floating platforms
for(float i = 0.0; i < 3.0; i++) {
vec3 plat = p;
float angle = t * (0.5 + i * 0.2) + i * 2.1;
plat.xz *= rot(angle);
plat.x -= 3.0 + i * 0.5;
plat.y -= sin(t * 0.7 + i) * 0.5;
float box = sdBox(plat, vec3(0.4, 0.1, 0.4));
d = min(d, box);
}
// Ground
d = min(d, p.y + 2.0 + noise(p * 0.5) * 0.3);
return d;
}
vec3 getNormal(vec3 p) {
float d = 0.002;
return normalize(vec3(
map(p + vec3(d,0,0)) - map(p - vec3(d,0,0)),
map(p + vec3(0,d,0)) - map(p - vec3(0,d,0)),
map(p + vec3(0,0,d)) - map(p - vec3(0,0,d))
));
}
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
float t = iTime * 0.25;
vec3 ro = vec3(cos(t) * 7.0, 2.0, sin(t) * 7.0);
vec3 rd = normalize(vec3(uv, -1.2));
float ca = atan(ro.z, ro.x);
rd.xz *= rot(ca);
rd.yz *= rot(-0.15);
vec3 col = vec3(0.0);
float dist = 0.0;
for(int i = 0; i < 100; i++) {
vec3 p = ro + rd * dist;
float d = map(p);
if(d < 0.001) {
vec3 n = getNormal(p);
vec3 light1 = normalize(vec3(2.0, 4.0, 3.0));
vec3 light2 = normalize(vec3(-3.0, 2.0, -2.0));
float diff = max(dot(n, light1), 0.0);
diff += max(dot(n, light2), 0.0) * 0.4;
vec3 base = vec3(0.0, 0.85, 1.0); // Electric cyan
if(p.y > 1.5) base = vec3(1.0, 0.2, 0.6); // Hot pink
col = base * (diff + 0.2) + vec3(0.3) * pow(max(dot(reflect(-light1, n), -rd), 0.0), 32.0);
col += vec3(0.0, 0.5, 0.8) * 0.1 / (1.0 + dist * 0.1); // Depth glow
break;
}
// Atmospheric scatter
col += vec3(0.02, 0.0, 0.05) * 0.02 / (1.0 + d);
dist += d;
if(dist > 25.0) break;
}
// Fog
col = mix(col, vec3(0.01, 0.0, 0.03), 1.0 - exp(-0.08 * dist));
// Post processing bloom
col = col * 1.3;
col = col / (1.0 + col * 0.5);
col = pow(col, vec3(0.455));
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.