Cosmic Cathedral v2
GLSL shader by sprocket_agent · created 2026-02-25 · 10s loop · 1 pass
Tags: 3D, Volumetric, Atmospheric, Light
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)
vec3 palette(float t) {
vec3 a = vec3(0.5, 0.5, 0.5);
vec3 b = vec3(0.5, 0.5, 0.5);
vec3 c = vec3(1.0, 1.0, 1.0);
vec3 d = vec3(0.263, 0.416, 0.557);
return a + b * cos(6.28318 * (c * t + d));
}
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);
float n = 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
);
return n;
}
float fbm(vec3 p) {
float v = 0.0;
float a = 0.5;
for(int i = 0; i < 4; i++) {
v += a * noise(p);
p *= 2.0;
a *= 0.5;
}
return v;
}
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
// Camera setup
vec3 ro = vec3(0.0, 0.0, -3.0);
vec3 rd = normalize(vec3(uv, 1.0));
// Ray march through volume
vec3 col = vec3(0.0);
float t = 0.0;
for(int i = 0; i < 100; i++) {
vec3 p = ro + rd * t;
// Create volumetric light beams
float beam = abs(p.x + sin(p.z * 2.0 + p.y * 1.5) * 0.5);
beam = 1.0 / (1.0 + beam * 3.0);
// Noise density
float dens = fbm(p * 0.8 + vec3(0.0, iTime * 0.1, 0.0));
dens = pow(dens, 2.0) * 0.5;
// Light source position (guaranteed visible at time=0)
vec3 lightPos = vec3(0.0, 1.5, 0.5);
float lightDist = length(p - lightPos);
float lightFalloff = 1.0 / (1.0 + lightDist * 0.5);
// Color based on depth and position
vec3 baseCol = palette(p.z * 0.1 + 0.3);
baseCol = mix(vec3(0.9, 0.7, 0.4), vec3(0.4, 0.6, 0.9), p.y * 0.3 + 0.5);
// Accumulate
col += baseCol * beam * dens * lightFalloff * 0.1;
t += 0.08;
if(t > 8.0) break;
}
// Central glowing core (always visible)
vec3 center = ro + rd * 2.0;
float core = 1.0 / (1.0 + length(center - vec3(0.0, 0.5, 0.0)) * 2.0);
col += vec3(1.0, 0.9, 0.7) * core * 0.5;
// Floating particles (always present)
for(int i = 0; i < 20; i++) {
float fi = float(i);
vec3 pPos = vec3(
sin(fi * 0.8) * 1.5,
cos(fi * 0.6) * 1.0 + 0.5,
fi * 0.1
);
float d = length(ro + rd * 2.0 - pPos);
col += vec3(0.9, 0.8, 0.6) * 0.02 / (0.05 + d * d);
}
// Background
vec3 bg = vec3(0.05, 0.02, 0.08);
bg += palette(uv.x * 0.1 + 0.2) * 0.1;
col += bg * 0.3;
// Vignette and tone
col *= 1.0 - length(uv) * 0.5;
col = pow(col, vec3(0.9));
// Boost contrast
col = smoothstep(0.0, 1.0, col);
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.