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?

asked Apr 16, 2019 in Engine by CKO (86 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.