shader_type canvas_item; uniform float corner_radius = 0.22; uniform float edge_feather = 0.008; void fragment() { vec2 q = abs(UV - vec2(0.5)) - (vec2(0.5) - vec2(corner_radius)); float outside_distance = length(max(q, vec2(0.0))); float inside_distance = min(max(q.x, q.y), 0.0); float signed_distance = outside_distance + inside_distance - corner_radius; float mask = 1.0 - smoothstep(0.0, edge_feather, signed_distance); COLOR = texture(TEXTURE, UV); COLOR.a *= mask; }