Shader Art!

Apr 27, 2025

I’ve always been really interested in Shader Art, it’s always been fascinating to me how the shapes all connect and fall off and ripple into each other. There is a lot of math involved in the process of creating shader art, and a lot of it I quite beyond my understanding… for now.

undefined

This is a shader from a video I was following and it is a lot to take in, the video was a very good watch and very informative. I will definitely watch it several more times. Link to video of shader

vec3 palette( float t) {
    vec3 a = vec3(0.5, 0.5, 0.5);
    vec3 b = vec3(0.5, 0.5, 0.5);
    vec3 c = vec3(1.0, 1.0, 1.0);
    vec3 d = vec3(0.263, 0.416, 0.557);
    
    return a + b*cos( 6.28318*(c*t+d) );
}

void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
    vec2 uv = (fragCoord * 2.0 - iResolution.xy) / iResolution.y;
    vec2 uv0 = uv;
    vec3 finalColor = vec3(0.0);
    
    for (float i = 0.0; i < 4.0; i++) {
        uv = fract(uv * 1.5) - 0.5;

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

        vec3 col = palette(length(uv0) + i*.4 + iTime*.4);

        d = sin(d*8. + iTime)/8.;
        d = abs(d);

        d = pow(0.01 / d, 1.2);

        col *= d;

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

Paste the code into (https://www.shadertoy.com/new)

On the C++ Engine side of things, I’ve separated and abstracted more of the login in the engine with an Application class and an Engine class derived from Application.

following this tutorial to learn how to abstract my classes and all that with openGL

https://www.youtube.com/watch?v=PiZ6_aDEL5Q&t=416s


Blog

Kero Mena