Project_2025-11-04_08-42-15

GLSL shader by scry · created 2025-11-04 · updated 2025-11-14 · 10s loop · 2 passes

Tags: 2d, Animation, Abstract, Symmetry, Layers

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
vec3 cs = vec3(1.,2.,3.);
mat2 r2d(float a) {
    return mat2(cos(a),sin(a),-sin(a),cos(a));
}

Buffer A (iChannel0)

// Hyper Anti-aliasing quality setting (9-12 for extreme quality)
// 9=256 samples, 10=512 samples, 11=1024 samples, 12=2048 samples
#define AA_QUALITY 4

void render(out vec4 fragColor, in vec2 fragCoord);

// Halton sequence generator for high-quality sampling
vec2 halton(int index, int base) {
    float result = 0.0;
    float f = 1.0;
    int i = index;
    while (i > 0) {
        f = f / float(base);
        result = result + f * float(i % base);
        i = i / base;
    }
    return vec2(result, fract(result * float(base)));
}

// Optimized sampling patterns for different quality levels
vec2 getSampleOffset(int index, int quality) {
    if (quality <= 8) {
        // Use standard patterns for quality 1-8
        if (quality == 1) return vec2(0.0);
        else if (quality == 2) {
            vec2 offsets[4] = vec2[4](
                vec2(-0.25, -0.25), vec2(0.25, -0.25),
                vec2(-0.25, 0.25), vec2(0.25, 0.25)
            );
            return offsets[index];
        }
        else if (quality == 3) {
            vec2 offsets[9] = vec2[9](
                vec2(-0.33, -0.33), vec2(0.0, -0.33), vec2(0.33, -0.33),
                vec2(-0.33, 0.0), vec2(0.0, 0.0), vec2(0.33, 0.0),
                vec2(-0.33, 0.33), vec2(0.0, 0.33), vec2(0.33, 0.33)
            );
            return offsets[index];
        }
        else if (quality == 4) {
            vec2 offsets[16] = vec2[16](
                vec2(-0.375, -0.375), vec2(-0.125, -0.375), vec2(0.125, -0.375), vec2(0.375, -0.375),
                vec2(-0.375, -0.125), vec2(-0.125, -0.125), vec2(0.125, -0.125), vec2(0.375, -0.125),
                vec2(-0.375, 0.125), vec2(-0.125, 0.125), vec2(0.125, 0.125), vec2(0.375, 0.125),
                vec2(-0.375, 0.375), vec2(-0.125, 0.375), vec2(0.125, 0.375), vec2(0.375, 0.375)
            );
            return offsets[index];
        }
        else if (quality == 5) {
            vec2 offsets[25] = vec2[25](
                vec2(0.000, 0.000), vec2(-0.326, -0.406), vec2(-0.840, -0.074), vec2(-0.696, 0.457),
                vec2(-0.203, 0.621), vec2(0.962, -0.195), vec2(0.473, -0.480), vec2(0.519, 0.767),
                vec2(0.185, -0.893), vec2(0.507, 0.064), vec2(0.896, 0.412), vec2(-0.322, -0.933),
                vec2(-0.792, -0.598), vec2(-0.345, 0.174), vec2(0.186, 0.469), vec2(-0.897, 0.417),
                vec2(0.054, -0.540), vec2(0.759, -0.650), vec2(-0.423, 0.886), vec2(0.377, 0.927),
                vec2(-0.715, -0.700), vec2(-0.024, -0.166), vec2(-0.594, 0.058), vec2(0.847, -0.469), vec2(0.351, 0.287)
            );
            return offsets[index] * 0.4;
        }
        else if (quality == 6) {
            float step = 1.0 / 6.0;
            int x = index % 6;
            int y = index / 6;
            return vec2((float(x) + 0.5) * step - 0.5, (float(y) + 0.5) * step - 0.5);
        }
        else if (quality == 7) {
            float angle = float(index) * 2.3999632297286533;
            float radius = sqrt(float(index)) / sqrt(49.0) * 0.5;
            return vec2(cos(angle), sin(angle)) * radius;
        }
        else { // quality == 8
            float step = 1.0 / 8.0;
            int x = index % 8;
            int y = index / 8;
            float jitterX = fract(sin(float(index) * 12.9898) * 43758.5453) * 0.1 - 0.05;
            float jitterY = fract(sin(float(index) * 78.233) * 43758.5453) * 0.1 - 0.05;
            return vec2((float(x) + 0.5) * step - 0.5 + jitterX, 
                       (float(y) + 0.5) * step - 0.5 + jitterY);
        }
    }
    else {
        // Hyper quality levels (9-12) using Halton sequences
        vec2 halton2 = halton(index, 2);
        vec2 halton3 = halton(index, 3);
        vec2 offset = vec2(halton2.x - 0.5, halton3.x - 0.5);
        
        // Add some blue noise characteristics for better distribution
        float angle = float(index) * 2.3999632297286533;
        float radius = sqrt(float(index)) / sqrt(1024.0) * 0.3;
        vec2 blueNoise = vec2(cos(angle), sin(angle)) * radius;
        
        return offset + blueNoise * 0.1;
    }
}

int getSampleCount(int quality) {
    if (quality <= 8) {
        int counts[8] = int[8](1, 4, 9, 16, 25, 36, 49, 64);
        return counts[quality - 1];
    } else {
        // Hyper quality levels: 9=256, 10=512, 11=1024, 12=2048
        int hyperCounts[4] = int[4](256, 512, 1024, 2048);
        return hyperCounts[quality - 9];
    }
}

void mainImage(out vec4 fragColor, in vec2 fragCoord) {
    vec3 col = vec3(0.);
    
    int sampleCount = getSampleCount(AA_QUALITY);
    
    // Accumulate samples
    for (int i = 0; i < sampleCount; i++) {
        vec4 renderColor;
        render(renderColor, fragCoord + getSampleOffset(i, AA_QUALITY));
        col += clamp(renderColor.rgb, 0., 1.);
    }
    
    // Average the samples
    col /= float(sampleCount);
    fragColor = vec4(col, 1.0);
}

vec3 c1(vec2 uv, float t) {
    vec3 col = vec3(0.);
    //float t=time;
    //uv = uv/dot(uv,uv);
    for (int i=0;i<8;i++) {
        //uv = abs(uv)-0.25;
        uv *= r2d(deg*45.);
        uv = uv/dot(uv,uv)*(-sin(t/4.+2.)*0.5+0.6)*0.5;
        uv = abs(uv)-0.01;
        
        uv += sin(uv.yx*12.)*0.01;
        //uv = abs(uv)-0.2;
        uv *= r2d(deg*-45.);
        uv = abs(uv);
        //uv *= r2d(deg*-45.);
        uv *= r2d(deg*20.+float(i)*pi/6.);
        //uv = abs(uv)-0.2+sin(t/2.)*0.3;
        uv += sin(abs(uv)*4.+t)*0.06;
        uv *= r2d(deg*-45.);
    }
    //uv = abs(uv)-0.2;
//    uv *= r2d(sin(t+uv.y*2.+uv.x*4.)/2.);
    for (int i=0;i<4;i++) {
        uv = abs(uv)-0.01;
        uv += vec2(sin(t),cos(t))*0.15;
        uv *= r2d(pi/4.);
    }
    uv.y = fract(uv.y*15.)-0.5;
    col += smoothstep(0.1,0.,uv.y);
    col *= 0.1;
    col += sin(uv.y*4.+cs)*0.8+0.;
    col = clamp(col*1.4-0.5,-0.,1.);
    return col;
}

void render(out vec4 fragColor, in vec2 fragCoord) {
    vec2 uv = fragCoord.xy / iResolution.xy;
    vec2 tv = uv;
    uv -= 0.5;
    uv.x *= ar;
    vec3 col = vec3(0.);
    for (int i=0;i<12;i++) {
        float ii = float(i);
        float fi = fract(ii/4.+time/pi/2.);
        float afi = abs(fi*2.-1.);
        float nafi = 1.-afi;
        vec2 av = uv*r2d(deg*45.);
        av += sin(av*40.+time*2.)*(fi-0.5)*0.01;
        av += sin(av.yx*12.)*(fi-0.5)*0.2;
        av += sin(abs(uv)*9.+time*2.)*0.2*(fi-0.5);
        col += c1(av,-time+ii*0.03)*nafi*0.2;
    }
    fragColor = vec4(col, 1.0);
}

Image

Not used

More shaders by scry

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

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

Account

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