#version 330 core
in vec2 vUV; out vec4 FragColor; uniform sampler2D uTex; uniform float uTime; uniform int uSegments; uniform float uRotationSpeed; uniform float uZoom; uniform float uRadialWarp; uniform float uColorShift; uniform float uAlpha; const float PI = 3.14159265359; void main(){ vec2 uv = vUV * 2.0 - 1.0; float r = length(uv); float ang = atan(uv.y, uv.x); ang += uTime * uRotationSpeed; float seg = (2.0 * PI) / float(uSegments); float a = mod(ang, seg); a = abs(a - seg * 0.5); vec2 p = vec2(cos(a), sin(a)) * r; float warp = 1.0 + uRadialWarp * sin(r * 12.0 - uTime * 1.3); p *= warp; vec2 tUv = p / uZoom + 0.5; tUv = fract(tUv); vec2 shift = vec2(cos(ang), sin(ang)) * uColorShift; float rr = texture(uTex, fract(tUv + shift)).r; float gg = texture(uTex, tUv).g; float bb = texture(uTex, fract(tUv - shift)).b; vec3 col = vec3(rr, gg, bb); FragColor = vec4(col, uAlpha); }