Kaleido pulse

glint · Examples · Tutorials · Gallery

Folded kaleidoscopic fractal that zooms and twists with the bass and flashes on the kick.

Audio-reactive: it moves with music from a microphone, line-in or a file.

Kaleido pulse: an audio-reactive GLSL shader

An example in glint, a free live shader editor in the browser: the GLSL code floats over the running picture and recompiles as you type.

The code

One pass, in GLSL.

fragment shader

#version 300 es
precision highp float;

uniform float time;
uniform vec2 resolution;
uniform vec3 spectrum;
uniform vec3 spectrumIntegrated;
uniform float beat;
uniform int beatCount;
uniform sampler2D fft;
uniform float folds;

in vec2 v_texcoord;
out vec4 fragColor;

mat2 rot(float a) { float c = cos(a), s = sin(a); return mat2(c, -s, s, c); }

void main() {
    vec2 uv = (gl_FragCoord.xy - 0.5 * resolution) / resolution.y;
    float mt = time * 0.1 + spectrumIntegrated.x * 0.5;
    uv *= rot(mt * 0.5);
    float n = floor(folds);
    float a = atan(uv.y, uv.x), r = length(uv);
    float seg = 6.28318 / n;
    a = abs(mod(a, seg) - seg * 0.5);
    vec2 p = vec2(cos(a), sin(a)) * r * (1.4 - 0.3 * spectrum.x);
    vec3 col = vec3(0.0);
    float scale = 1.0;
    for (int i = 0; i < 7; i++) {
        p = abs(p) - vec2(0.5 + 0.1 * sin(mt), 0.3);
        p *= rot(0.6 + mt * 0.2);
        p *= 1.35;
        scale *= 1.35;
        float d = length(p) / scale;
        col += (0.5 + 0.5 * cos(6.28318 * (float(i) * 0.12 + mt * 0.2 + vec3(0.0, 0.33, 0.67)))) * 0.0025 / (d * d + 0.0015);
    }
    col *= 0.25 + 0.75 * spectrum.y + beat;
    col = 1.0 - exp(-col);
    fragColor = vec4(col, 1.0);
}

More Starters examples

Dal Platinum · Bass rings · Radial spectrum · Ridgelines · Laser show · Metaballs · Oscilloscope trails · Hyperspace