Project_2026-01-18_00-22-37

GLSL shader by scry · created 2026-01-18 · updated 2026-01-19 · 40s 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/40. //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));
}
vec3 rgb2hsv(vec3 c){vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));vec4
 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r)); float d
=  q.x - min(q.w, q.y);float e = 1.0e-10;return vec3(abs(q.z + (q.w -
 q.y) / (6.0 * d + e)), d / (q.x + e), q.x);}vec3 hsv2rgb( vec3 c ) {
 vec4 K = vec4( 1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); vec3 p = abs( fract(
 c.xxx + K.xyz ) * 6.0 - K.www);  return c.z * mix( K.xxx, clamp( p -
K.xxx, 0.0, 1.0), c.y);}float bitm(vec2 uv,int c) {float h = 5.;float
 w = 3.;int p = int(pow(2.,w)); float line1 = 9591.; uv = floor(vec2(
 uv.x*w,uv.y*h))/vec2(w,w);float c1 = 0.;float cc = uv.x + uv.y*w; c1
=  mod( floor( float(c) / exp2(ceil(cc*w-0.6))) ,2.); c1 *= step( 0.,
uv.x)*step(0.,uv.y);c1 *= step(0.,(-uv.x+0.99))*step(0.,(-uv.y+1.6));
return (c1);}vec3 slogo(vec2 uv, float ar_, float size) {size = 240./
size;uv.x = 1.-uv.x;vec2 px = vec2(1./3.,1./5.); float ls = 4.1;uv *=
 240./5.25/size;ls += 2.;float ul = length(uv);ul = length(vec2(uv.x*
 0.5,uv.y)-0.5);uv -= 0.4;uv.x *= ar*1.75;uv.y *= 1.04;int s = 29671;
 int c = 29263;int r = 31469; int y = 23186; uv.x= 5.-uv.x; float b =
bitm(uv,s); uv.x -= 1./3.*4.; b += bitm( uv,c); uv.x -= 1./3.*4.;b +=
 bitm(uv,r);uv.x -= 1./3.*4.;b += bitm(uv,y);float rr = step(0.,uv.x+
 px.x*13.)*step(0.,uv.y+px.y)*step(0.,(-uv.x+px.x*4.))*step(0.,(-uv.y
 +px.y*6.));b = clamp(b,0.,1.);vec3 l = hsv2rgb(vec3(b+iTime/40.,0.1,
 rr-b*1.9))*rr; l -= 0.1-clamp(ul*0.1, rr*1.-b,0.1); return vec3(l.x,
 clamp(l.x,0.,1.)-l.x,clamp(-l.x,0.,1.));}

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 2

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);
}


float box(vec2 p, vec2 b) {
    vec2 d = abs(p) - b;
    return length(max(d, 0.0)) + min(max(d.x, d.y), 0.0);
}
float zoom = 0.4;
vec4 boxUV(vec2 p, vec2 center, vec2 size) {
    vec2 localUV = (p - center) / size;
    localUV = localUV * 0.5 + 0.5;
    float d = box(p - center, size);
    localUV += center*(1./zoom)*0.99;
    return vec4(localUV, d, step(d,0.));
}

vec4 getBox(int i, vec2 uv) {
    float fi = float(i)*pi*1.1;
    vec2 center = vec2(
        0.5 * sin(sin(time+7.)*4. * (0.1 + fi * 0.001) + fi+5.) * cos(fi * 0.9),
        0.5 * cos(sin(time+7.)*4. * (0.1 + fi * 0.0015) + fi * 1.3+5.) * sin(fi * 0.8)
    );
    //center *= 0.1;
    vec2 size = vec2(0.2 + sin(fi+time) * 0.25, 0.2 + cos(fi * 1.+time) * 0.25);
    size *= 0.5;
    return boxUV(uv, center, size);
}

void render(out vec4 fragColor, in vec2 fragCoord) {
    vec2 uv = fragCoord.xy / iResolution.xy;
    vec2 tv = uv;
    
    float thickness = 0.002;
    uv -= 0.5;
    uv.x *= ar;
    //uv *= 1.;
    //uv = uv/dot(uv,uv)*0.5;
    //uv -= 0.5;
    //uv *= 2.;
    //uv.xy = abs(fract(uv.xy/1.-0.5)*2.)-1.;
    //uv = uv/dot(uv,uv)*.1;
    //uv += sin(time/2.+vec2(0.,1.57))*0.4;
    //uv *= 0.2;
    uv -= 0.5;
    uv = abs(fract(uv/2.)*2.-1.)-0.5;
    //uv += 0.5;
    //uv *= 0.3;
    //uv += 0.5;
    //uv = uv/dot(uv,uv)*0.1;
    //uv *= r2d(time);
    vec3 col = vec3(0.0);
    //uv *= 3.;
    int numBoxes = 48;
    float d = 1e9;
    vec3 t = vec3(0.);
    for (int i = 0; i < numBoxes; i++) {
        vec4 b = getBox(i, uv);
        vec3 bc = (sin(float(i)*pi/2.+cs+time*10.)*0.2+0.8);
        b.xy -= 0.5;
        b.xy *= zoom;
        //b.xy = b.xy/dot(b.xy,b.xy)*0.5;
        //b.xy *= r2d(deg*90.*sin(float(i)*pi/1.));
        b.xy *= r2d(deg*90.);
        //b.xy = abs(b.xy-0.5);
        b.xy += 0.5;
        b.xy = abs(fract(b.xy/2.-0.5)*2.-1.);
        //b.xy *= 0.75;
        if (b.z < 0.0) t = texture(iChannel0, b.xy).rgb*bc;
        t = rgb2hsv(t);
        t.x += 0.25*float(i);
        //t.y *= 1.01;
        //t.z *= 1.1;
        //t.z = 0.99;
        t.y = 0.8;
        //t.z = smoothstep(0.,0.001,abs(b.z)-thickness);
        //t.z += b.w*0.5;
        t = hsv2rgb(t);
        col = t;
        d = min(d+b.w,b.z+thickness);
        //d = min(d+b.w, abs(b.z) - thickness);
        //col.rg += b.xy*b.w;
    }
    
    col = mix(col, vec3(1.0), 1.0 - smoothstep(0.0, 0.001, abs(d)-thickness));
    //col += sin(d*410.)*step(-d,0.);
    //col = mix(col,texture(iChannel0,tv).rgb,0.2);
    //vec3 sl = slogo(tv,1.,220./1.)
    //col += sl.x;

    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