Project_2026-01-16_00-17-18

GLSL shader by scry · created 2026-01-16 · 10s loop · 2 passes

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.  //1 degree
#define time iTime*2.*pi/10. //sin(time) loops 10 seconds
#define R iResolution.xy //shorthand
#define ar R.x/R.y //aspect ratio
#define M iMouse //shorthand
#define xm (M.xy/R) //normalized mouse
#define nm ((xm.xy-0.5)*vec2(ar,1.)+0.5) //aspect ratio correction
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);
}


void render(out vec4 fragColor, in vec2 fragCoord) {
    vec2 uv = fragCoord.xy / iResolution.xy;
    vec2 tv = uv;
    uv -= 0.5;
    uv.x *= ar;
    float m = 1.;
    vec3 col = vec3(0.);
    uv = uv/dot(uv,uv)*0.02;
    uv *= 2.;
    for (int i=0;i<10;i++) {
        uv += sin(uv.yx*40.+time)*0.003;
        uv *= r2d(deg*45.*0.);
    }
    uv *= 1.5;
    uv *= r2d(time);
    uv = uv/dot(uv,uv)*0.03;
    for (int i=0;i<10;i++) {
        uv += sin(uv.yx*40.+time)*0.001;
        uv *= r2d(deg*45.*0.);
    }
    uv *= 2.;
    uv *= r2d(-time);
    uv = uv/dot(uv,uv)*4.;
    m *= sin(uv.x*0.1+time*4.)*0.4+0.6;
    for (int i=0;i<10;i++) {
        uv += sin(uv.yx*7.)*0.15;
        uv *= r2d(deg*45.*0.);
    }
    uv *= r2d(sin(time+uv.x*0.05)*deg*45./2.);
    col += sin(uv.x*20.+time*4.+cs);
    col *= m;
    col *= 0.99;
    col = clamp(col,0.,1.);
    //tv += uv*-0.0005;
    //col += texture(iChannel0, tv).rgb * 0.9;
    //col *= 0.6;
    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