Strange texture wrapping problem (fragment shader)

Viewed 20

I have this code (from Shadertoy):

void mainImage( out vec4 fragColor, in vec2 fragCoord ) {
    vec2 uv = (fragCoord - 0.5*iResolution.xy) / iResolution.y; 
    fragColor = texture(iChannel0, vec2(atan(uv.y, uv.x)/6.28, 0.1/length(uv))); 
}

...which creates an horizontal line glitch. enter image description here

If I slightly transform the first line :

void mainImage( out vec4 fragColor, in vec2 fragCoord ) {
    vec2 uv = fragCoord / iResolution.xy;
    uv -= 0.5;
    uv.x *= iResolution.x / iResolution.y;
    
    fragColor = texture(iChannel0, vec2(atan(uv.y, uv.x)/6.28, 0.1/length(uv))); 
}

...no more problem. enter image description here

I don't even know where to start to understand what is happening !

0 Answers
Related