Forgive me, I'm new to shaders. I copied a shader from Shadertoy and used the guide: https://docs.godotengine.org/en/stable/tutorials/shaders/converting_glsl_to_godot_shaders.html
to convert it for Godot. It achieves the pixel blur effect I wanted, but the image is upside down and mirrored. It also moves the image down and to the left over time and it's zoomed in. I would like to learn more about GLSL and shader language in general, so the more help and explanation you can give the better. Pretend I'm a 5-year-old. Thanks very much in advance!
Here's the original code:
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
float t = mod(iTime, 3.0);
vec2 uv = fragCoord.xy / iResolution.xy;
float _Speed = 15.0;
float res = floor((pow(t,1.4)) * _Speed) * 2.0 + 0.01;
uv *= iResolution.xy / res;
uv = floor(uv);
uv /= iResolution.xy / res;
uv += res * 0.002;
vec4 texture = texture(iChannel0, uv);
fragColor = texture * clamp(1.4 - t, 0.0, 1.0);
}
and here's my conversion:
shader_type canvas_item;
void fragment()
{
float t = mod(TIME, 3.0);
vec2 uv = FRAGCOORD.xy / (1.0 / SCREEN_PIXEL_SIZE).xy;
float _Speed = 15.0;
float res = floor((pow(t,1.4)) * _Speed) * 2.0 + 0.01;
uv *= (1.0 / SCREEN_PIXEL_SIZE).xy / res;
uv = floor(uv);
uv /= (1.0 / SCREEN_PIXEL_SIZE).xy / res;
uv += res * 0.002;
vec4 texture = texture(TEXTURE, uv);
COLOR = texture * clamp(1.4 - t, 0.0, 1.0);
}