Project_2026-02-24_17-16-06

GLSL shader by scry · created 2026-02-25 · 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)

float sdTriangle(in vec2 p, in vec2 p0, in vec2 p1, in vec2 p2) {
    vec2 e0 = p1-p0, e1 = p2-p1, e2 = p0-p2;
    vec2 v0 = p -p0, v1 = p -p1, v2 = p -p2;
    vec2 pq0 = v0 - e0*clamp( dot(v0,e0)/dot(e0,e0), 0.0, 1.0 );
    vec2 pq1 = v1 - e1*clamp( dot(v1,e1)/dot(e1,e1), 0.0, 1.0 );
    vec2 pq2 = v2 - e2*clamp( dot(v2,e2)/dot(e2,e2), 0.0, 1.0 );
    float s = sign( e0.x*e2.y - e0.y*e2.x );
    vec2 d = min(min(vec2(dot(pq0,pq0), s*(v0.x*e0.y-v0.y*e0.x)),
                     vec2(dot(pq1,pq1), s*(v1.x*e1.y-v1.y*e1.x))),
                     vec2(dot(pq2,pq2), s*(v2.x*e2.y-v2.y*e2.x)));
    return -sqrt(d.x)*sign(d.y);
}

void mainImage(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.);
    uv *= 4.;
    float r = atan(uv.x,uv.y);
    for (int i=0;i<10;i++) {
        //uv.x = abs(uv.x);
        //uv.y = abs(uv.y);
        //uv += sin(uv*10.+time)*0.01;
        //uv.y = abs(uv.y);
        //uv *= r2d(deg*45.);
        r += atan(uv.x,uv.y);
        uv = abs(uv)-0.5+sin(time+float(i)*pi/3.+0.)*0.1;
        uv += sin(uv*10.+time)*0.05;
        uv += sin(uv.yx+time*2.)*0.2;
        //uv *= 1.2;
    }
    uv = abs(uv)-0.25;
    float d = sdTriangle(uv, vec2(0., 0.3), vec2(-0.3, -0.2), vec2(0.3, -0.2));
    col = mix((sin(cs*1.5+time*20.+d*4.+r)*0.2+0.2)*(d*10.+2.), col, step(0., d+0.05));
    col = mix(vec3(0.), col, smoothstep(0.005, 0.01, abs(d)));
    col = mix(sin(cs+atan(uv.x,uv.y)+time*40.+r), col, smoothstep(0.015, 0.02, abs(d)));
    
    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