shader_type canvas_item; // Remove the white backing from the original JPEG atlas at render time. void fragment() { vec4 texel = texture(TEXTURE, UV); float background = smoothstep(0.86, 0.98, min(texel.r, min(texel.g, texel.b))); COLOR.a *= 1.0 - background; }