The Code Therapy

Very Trippy

What I imagine being high (on life) feels like

Created by mgshadermaster on Mon, 14 Aug 2023 16:23:06 GMT.


#version 300 es
precision highp float;

uniform vec2 resolution;
uniform float time;
out vec4 fragColor;

vec3 palette(float t){
    vec3 a = vec3(0.168, 0.5, 1.108); // Wow cores show (:
    vec3 b = vec3(-0.082, 0.5, 0.528);
    vec3 c = vec3(3.138, 1.998, 0.0);
    vec3 d = vec3(0.0, 0.333, 0.528);

    return a + b*cos(6.28318*(c*t+d));
}

void main(void){
    vec2 uv = gl_FragCoord.xy / resolution.xy * 2.0 - 1.0;
    uv.x *= resolution.x / resolution.y;
    vec2 uv0 = uv;
    vec3 finalColor = vec3(0.0);
    for (float i = 0.0; i < 3.0; i += 1.0){
        uv *= 1.6;
        uv = fract(uv);
        uv -= 0.5;

        float d0 = length(uv0);
        float d = length(uv) * exp(-length(uv0));


        vec3 col = palette(d0 + i*0.2 + time*0.2);

        d = sin(d*8.0 + time)/8.0;
        d = abs(d);

        d = pow(0.0125 / d, 1.7);

        finalColor += col * d;
    }
    fragColor = vec4(finalColor,1.0);
}