Sprite shader with Overlay

in the default sprite shader I replaced

			fixed4 frag(v2f IN) : SV_Target
				fixed4 c = tex2D(_MainTex, IN.texcoord) * IN.color;
				c.rgb *= c.a;
				return c;


			fixed4 frag(v2f IN) : SV_Target
                float4 t = tex2D(_MainTex, IN.texcoord);
				float4 o = Overlay(t, _Color);
				o.a = t.a;
				return o;

the Overlay include uses this code

float4 Overlay (float4 a, float4 b) {
    float4 r = float4(0,0,0,1);
    if (a.r > 0.5) { r.r = 1-(1-2*(a.r-0.5))*(1-b.r); }
    else { r.r = (2*a.r)*b.r; }
    if (a.g > 0.5) { r.g = 1-(1-2*(a.g-0.5))*(1-b.g); }
    else { r.g = (2*a.g)*b.g; }
    if (a.b > 0.5) { r.b = 1-(1-2*(a.b-0.5))*(1-b.b); }
    else { r.b = (2*a.b)*b.b; }
    return r;

the blend mode function works well but i still can see the mesh rectangle

here’s the how is the texture made, preview of the alpha and how looks the final sprite in unity

what’s wrong? i am using alpha from the image only, so it should be transparent

From your third picture (how it looks in u3d), I’m going to make a few guesses. I can’t tell easily whether it could be one or both of these leading to what you’re seeing.

First, I get the impression you might be using a PNG for your texture. There’s nothing wrong with that, per se, but it means that areas with 0 alpha also contain no color data. In place of that, you might want to consider trying TIFF or TGA or something.

(Regardless of whether that’s the case, I LOVE PNG format. It’s fantastic)

Second, the image gives me the alternative impression that your shader itself isn’t capable of transparency. In this case, you’re writing somewhat arbitrary data into the 0-alpha sections of the image. To verify this, you can also try setting all colors with 0 opacity to black.

o.rgb *= o.a;