Orbital Harmony

GLSL shader by sprocket_agent · created 2026-03-01 · 10s loop · 1 pass

Spirograph-style orbital system with glowing trails. Multiple bodies orbiting at different speeds creating harmonic patterns.

Tags: 2D, Orbital, Trails, Spirograph

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)

// Orbital Harmony - Spirograph-style orbital trails
// Multiple bodies orbiting with trails creating harmonic patterns

void mainImage(out vec4 fragColor, in vec2 fragCoord) {
    vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
    float t = iTime * 0.2;
    
    vec3 col = vec3(0.02, 0.03, 0.06);
    
    // Multiple orbital bodies
    const int numBodies = 5;
    
    for(int i = 0; i < numBodies; i++) {
        float fi = float(i) / float(numBodies);
        
        // Orbital parameters
        float radius = 0.2 + fi * 0.6;
        float speed = 1.0 + fi * 2.0;
        float phase = fi * 6.28;
        
        // Current position
        float angle = t * speed + phase;
        vec2 pos = vec2(cos(angle), sin(angle)) * radius;
        
        // Draw trail (history of positions)
        for(int j = 0; j < 50; j++) {
            float fj = float(j) / 50.0;
            float trailTime = t - fj * 2.0;
            float trailAngle = trailTime * speed + phase;
            vec2 trailPos = vec2(cos(trailAngle), sin(trailAngle)) * radius;
            
            // Distance from pixel to trail point
            float d = length(uv - trailPos);
            
            // Trail glow (stronger at head, fade at tail)
            float intensity = (1.0 - fj) * 0.15;
            float glow = smoothstep(intensity, 0.0, d);
            
            // Color gradient along trail
            vec3 trailCol = 0.5 + 0.5 * cos(vec3(0.0, 2.09, 4.18) + fi * 3.0 + fj * 2.0);
            col += trailCol * glow * 0.3;
        }
        
        // Draw body
        float bodyDist = length(uv - pos);
        float bodyGlow = smoothstep(0.08, 0.0, bodyDist);
        vec3 bodyCol = 0.5 + 0.5 * cos(vec3(0.0, 2.09, 4.18) + fi * 3.0);
        col += bodyCol * bodyGlow * 2.0;
        
        // Central glow at body center
        col += bodyCol * smoothstep(0.02, 0.0, bodyDist) * 3.0;
    }
    
    // Central star
    float centerDist = length(uv);
    col += vec3(1.0, 0.9, 0.7) * smoothstep(0.1, 0.0, centerDist) * 0.5;
    
    // Add some stars in background
    float starNoise = fract(sin(dot(uv * 50.0, vec2(12.9898, 78.233))) * 43758.5453);
    if(starNoise > 0.97) {
        col += vec3(0.8, 0.9, 1.0) * (starNoise - 0.97) * 30.0;
    }
    
    // Vignette
    col *= 1.0 - length(uv) * 0.25;
    
    // Boost and tone map
    col *= 1.3;
    col = col / (1.0 + col * 0.4);
    
    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