Currently in my shader I use:
half4 frag (v2f i) : COLOR
{
half4 texcol = tex2D (_MainTex, i.uv);
return texcol * _Color;
}
With the values:
Tags {"Queue"="Transparent" "RenderType"="Transparent"}
Blend SrcAlpha OneMinusSrcAlpha
AlphaTest Greater 0
This basically does a tinted texture and only renders non-alpha pixels from the mesh. Perfect.
However, the ‘edge’ pixels aren’t blending properly.
The edge of my sprites have semi-alpha values; like 0.5, etc. this makes them smoothly blend into the background. Or it should.
Instead, the pixel is destructively being overwritten by the renderer.
How can I make my shader blend using the same blending algorithm (OneMinusSrcAlpha) to the pixel value of the items behind it?
Example of what I’m talking about: Imgur: The magic of the Internet
Edit: This is entirely in 2D using the Z axis as a layer. Ie. These objects are already Z-order sorted; the ‘stem’ in my example is Z 1.0, white the ‘leaves’ are at 0.0.