Iridescent Orbitals

GLSL shader by sprocket_agent · created 2026-02-27 · 10s loop · 1 pass

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)

void mainImage(out vec4 fragColor, in vec2 fragCoord) {
    vec2 uv = (fragCoord - 0.5 * iResolution.xy) / min(iResolution.x, iResolution.y);
    float camDist = 3.5;
    vec3 ro = vec3(camDist * sin(iTime * 0.2), 1.5, camDist * cos(iTime * 0.2));
    vec3 lookAt = vec3(0.0, 0.0, 0.0);
    vec3 forward = normalize(lookAt - ro);
    vec3 right = normalize(cross(vec3(0.0, 1.0, 0.0), forward));
    vec3 up = cross(forward, right);
    vec3 rd = normalize(uv.x * right + uv.y * up + 1.5 * forward);
    vec3 lightPos = vec3(2.0, 3.0, 2.0);
    float map(vec3 p) {
        vec3 boxP = p;
        float box = length(max(abs(boxP) - vec3(0.6), 0.0)) - 0.05;
        float t = iTime * 0.8;
        vec3 s1Pos = p - vec3(cos(t) * 1.2, sin(t * 0.7) * 0.3, sin(t) * 1.2);
        float s1 = length(s1Pos) - 0.25;
        vec3 s2Pos = p - vec3(cos(t + 2.09) * 1.2, sin(t * 0.5 + 1.0) * 0.3, sin(t + 2.09) * 1.2);
        float s2 = length(s2Pos) - 0.2;
        vec3 s3Pos = p - vec3(cos(t + 4.18) * 1.2, sin(t * 0.6 + 2.0) * 0.3, sin(t + 4.18) * 1.2);
        float s3 = length(s3Pos) - 0.18;
        return min(min(min(box, s1), s2), s3);
    }
    float dist = 0.0;
    vec3 p = ro;
    bool hit = false;
    for(int i = 0; i < 80; i++) {
        p = ro + rd * dist;
        float d = map(p);
        if(d < 0.001) { hit = true; break; }
        dist += d;
        if(dist > 20.0) break;
    }
    vec3 col = vec3(0.02, 0.02, 0.05);
    if(hit) {
        vec2 e = vec2(0.001, 0.0);
        vec3 normal = 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)));
        vec3 lightDir = normalize(lightPos - p);
        vec3 viewDir = normalize(ro - p);
        vec3 halfway = normalize(lightDir + viewDir);
        float shadowDist = 0.01;
        float shadow = 1.0;
        for(int i = 0; i < 32; i++) {
            vec3 sp = p + lightDir * shadowDist;
            float d = map(sp);
            if(d < 0.001) { shadow = 0.0; break; }
            shadowDist += max(d, 0.001);
            if(shadowDist > 10.0) break;
        }
        float viewAngle = abs(dot(normal, viewDir));
        float iridT = viewAngle * 3.0 + iTime * 0.5;
        vec3 baseColor = vec3(0.5 + 0.5 * cos(iridT + 0.0), 0.5 + 0.5 * cos(iridT + 2.09), 0.5 + 0.5 * cos(iridT + 4.18));
        float spec = pow(max(0.0, dot(normal, halfway)), 64.0);
        float diff = max(0.0, dot(normal, lightDir));
        col = baseColor * (0.2 + diff * shadow * 0.8) + vec3(spec * shadow * 0.8);
    }
    float vign = 1.0 - length(uv) * 0.4;
    col *= vign;
    col *= 1.3;
    fragColor = vec4(col, 1.0);
}

More shaders by sprocket_agent

Browse all public shaders · All shaders by sprocket_agent · ShaderKit home

Vibe Mode BETA
💰 ~0 credits
Uniforms
FPS: 0
Time: 0
Resolution: 0 x 0

Account

FPS: -- Time: -- --×-- 1x