Can someone help me with my shader?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Amateur.game.dev.

So I have a general shader for my armour, but for the boots the glowing effect is like this: goldboots
if you go to the image, you can see that the bottom of the glow for the boots shows at the top of the sprite. I would like to know an alternative shader which could help this please.

gold boots

shader_type canvas_item;
render_mode blend_premul_alpha;

uniform float radius = 1.0;
uniform float amount = 0.5;

void fragment() {
    float r = radius;
    vec2 ps = TEXTURE_PIXEL_SIZE;
    vec4 col = texture(TEXTURE, UV);
    vec4 glow = col;

    glow += texture(TEXTURE, UV + vec2(-r, -r) * ps);
    glow += texture(TEXTURE, UV + vec2(-r, 0.0) * ps);
    glow += texture(TEXTURE, UV + vec2(-r, r) * ps);
    glow += texture(TEXTURE, UV + vec2(0.0, -r) * ps);
    glow += texture(TEXTURE, UV + vec2(0.0, r) * ps);
    glow += texture(TEXTURE, UV + vec2(r, -r) * ps);
    glow += texture(TEXTURE, UV + vec2(r, 0.0) * ps);
    glow += texture(TEXTURE, UV + vec2(r, r) * ps);

    r *= 2.0;
    glow += texture(TEXTURE, UV + vec2(-r, -r) * ps);
    glow += texture(TEXTURE, UV + vec2(-r, 0.0) * ps);
    glow += texture(TEXTURE, UV + vec2(-r, r) * ps);
    glow += texture(TEXTURE, UV + vec2(0.0, -r) * ps);
    glow += texture(TEXTURE, UV + vec2(0.0, r) * ps);
    glow += texture(TEXTURE, UV + vec2(r, -r) * ps);
    glow += texture(TEXTURE, UV + vec2(r, 0.0) * ps);
    glow += texture(TEXTURE, UV + vec2(r, r) * ps);

    glow /= 21.0;
    glow *= amount;
    col.rgb *= col.a;

    COLOR = glow + col;
}

What exactly do you need help with?

exuin | 2021-09-10 18:42

if you go to the image, you can see that the bottom of the glow for the boots shows at the top of the sprite. I would like to know an alternative shader which could help this please.

Amateur.game.dev. | 2021-09-10 22:19