Hi unikron, I'm having the same problem now and want to know logics behind this weird result. (TBH It's first time touching unity shader system, but I'm learning while trying to fix this)
So I put 2 sprites in the scene - one using tk2dSprite, one using unity5's SpriteRenderer.
Assign these objects to this library's script. Then in MonoBehaviour OnPreCull() method
1. It automatically moves my outline objects to temporary layer
2. Apply Buffer shader to my outline objects.
3. Captures temp layer to RenderTexture instance using temp camera.(<- Seems like this is the bug point)
4. Then draw outline using outline shader in OnRenderImage() method with Graphics.Blit()
I've checked step 2's Buffer Shader Surface code, It looks like this :
void surf (Input IN, inout SurfaceOutput o)
{
fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * IN.color;
float alpha = c.a * 99999999;
o.Albedo = _Color * alpha;
o.Alpha = alpha;
}
And in step 3's shader(which draws an actual outline) I just modified a bit to draw alpha value as red value. Screenshot of this test :
So it seems like there's a problem in capturing camera to RenderTexture in OnPreCull() method, It has transparent pixels as Colored pixels. Well, I think it's for some reason but I'm not smart enough to figure this out...How can I fix this? I'd appreciated if you help.