0 votes

I am using the following sprite outline shader that was provided by the community:

shader_type canvas_item;
render_mode unshaded;

uniform float width : hint_range(0.0, 16.0);
uniform vec4 outline_color : hint_color;

void fragment()
{
    vec2 size = vec2(width) / vec2(textureSize(TEXTURE, 0));

    vec4 sprite_color = texture(TEXTURE, UV);

    float alpha = sprite_color.a;
    alpha += texture(TEXTURE, UV + vec2(0.0, -size.y)).a;
    alpha += texture(TEXTURE, UV + vec2(size.x, -size.y)).a;
    alpha += texture(TEXTURE, UV + vec2(size.x, 0.0)).a;
    alpha += texture(TEXTURE, UV + vec2(size.x, size.y)).a;
    alpha += texture(TEXTURE, UV + vec2(0.0, size.y)).a;
    alpha += texture(TEXTURE, UV + vec2(-size.x, size.y)).a;
    alpha += texture(TEXTURE, UV + vec2(-size.x, 0.0)).a;
    alpha += texture(TEXTURE, UV + vec2(-size.x, -size.y)).a;

    vec3 final_color = mix(outline_color.rgb, sprite_color.rgb, sprite_color.a);
    COLOR = vec4(final_color, clamp(alpha, 0.0, 1.0));
}

I am using it on a tilemap. When the tilemap's ysort property is enabled, the shader stops working.

Any ideas on how this could be fixed?

in Engine by (92 points)

Submitted the following issue on github: https://github.com/godotengine/godot/issues/28115

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.