// Uniforms to control the visual effect const vec4 colour_1 = vec4(0.996, 0.373, 0.333, 1.0); // First color const vec4 colour_2 = vec4(0.0, 0.616, 1.0, 1.0); // Second color const vec4 colour_3 = vec4(0.216, 0.259, 0.267, 1.0) - vec4(0.31, 0.39, 0.404, 1.0); // Third color const float contrast = 1.5; // Contrast level const float spin_amount = .7; // Amount of swirl #define PIXEL_SIZE_FAC 700. #define SPIN_EASE 0.5 void mainImage( out vec4 fragColor, in vec2 fragCoord ) { // Convert to UV coords (0-1) and apply pixelation effect float pixel_size = length(iResolution.xy) / PIXEL_SIZE_FAC; vec2 uv = (floor(fragCoord.xy * (1. / pixel_size)) * pixel_size - 0.5 * iResolution.xy) / length(iResolution.xy); float uv_len = length(uv); // Adding in a center swirl that changes with time, only significant if 'spin_amount' is non-zero float speed = (iTime * SPIN_EASE * 0.2) + 302.2; float new_pixel_angle = (atan(uv.y, uv.x)) + speed - SPIN_EASE * 20. * (1. * spin_amount * uv_len + (1. - 1. * spin_amount)); vec2 mid = (iResolution.xy / length(iResolution.xy)) / 2.; uv = (vec2((uv_len * cos(new_pixel_angle) + mid.x), (uv_len * sin(new_pixel_angle) + mid.y)) - mid); // Apply a paint-like effect to the swirled UV coordinates uv *= 30.; speed = iTime * 2.; vec2 uv2 = vec2(uv.x + uv.y); for(int i = 0; i < 5; i++) { uv2 += sin(max(uv.x, uv.y)) + uv; uv += 0.5 * vec2(cos(5.1123314 + 0.353 * uv2.y + speed * 0.131121), sin(uv2.x - 0.113 * speed)); uv -= 1.0 * cos(uv.x + uv.y) - 1.0 * sin(uv.x * 0.711 - uv.y); } // Determine the final color by blending three colors based on the paint effect float contrast_mod = (0.25 * contrast + 0.5 * spin_amount + 1.2); float paint_res = min(2., max(0., length(uv) * 0.035 * contrast_mod)); float c1p = max(0., 1. - contrast_mod * abs(1. - paint_res)); float c2p = max(0., 1. - contrast_mod * abs(paint_res)); float c3p = 1. - min(1., c1p + c2p); vec4 ret_col = (0.3 / contrast) * colour_1 + (1. - 0.3 / contrast) * (colour_1 * c1p + colour_2 * c2p + vec4(c3p * colour_3.rgb, c3p * colour_1.a)); fragColor = vec4(ret_col.rgb * 0.3, 1.0); }