Compound image from different Render to texture layers. Alpha problem

Hi there!

I’m having some problems with render texture. I’m using 2DToolkit sprites to combine different layers. Each sprite shader code is this one:

Shader "tk2d/BlendVertexColor+8" 
{
    Properties 
    {
        _MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
    }
    
    SubShader
    {
        Tags {"Queue"="Transparent+8" "IgnoreProjector"="True" "RenderType"="Transparent"}
        ZWrite Off Lighting Off Cull Off Fog { Mode Off } Blend SrcAlpha OneMinusSrcAlpha
        ColorMask RGB
        LOD 110
        
        Pass 
        {
            CGPROGRAM
            #pragma vertex vert_vct
            #pragma fragment frag_mult 
            #pragma fragmentoption ARB_precision_hint_fastest
            #include "UnityCG.cginc"

            sampler2D _MainTex;
            float4 _MainTex_ST;

            struct vin_vct 
            {
                float4 vertex : POSITION;
                float4 color : COLOR;
                float2 texcoord : TEXCOORD0;
            };

            struct v2f_vct
            {
                float4 vertex : POSITION;
                fixed4 color : COLOR;
                float2 texcoord : TEXCOORD0;
            };

            v2f_vct vert_vct(vin_vct v)
            {
                v2f_vct o;
                o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);
                o.color = v.color;
                o.texcoord = v.texcoord;
                return o;
            }

            fixed4 frag_mult(v2f_vct i) : COLOR
            {
                fixed4 col = tex2D(_MainTex, i.texcoord) * i.color;
                return col;
            }
            
            ENDCG
        } 
    }
 
    SubShader
    {
        Tags {"Queue"="Transparent+8" "IgnoreProjector"="True" "RenderType"="Transparent"}
        ZWrite Off Blend SrcAlpha OneMinusSrcAlpha Cull Off Fog { Mode Off }
        LOD 100

        BindChannels 
        {
            Bind "Vertex", vertex
            Bind "TexCoord", texcoord
            Bind "Color", color
        }

        Pass 
        {
            Lighting Off
            SetTexture [_MainTex] { combine texture * primary } 
        }
    }
}

Well, I have to combine different render to textures to compound the final image (using alpha formula Pa+Pb(1-Pa)). However, the main scene Rendertexture seems to have some “transparent” zones without reason. Can anyone help with this please? Perhaps I could transform this image to delete that “grey” zones created automatically from the render texture.

Thank you in advance!

1256402--54847--$AlphaChannelRenderTexture.jpg

Please, we really do need help with this.

So, I’ve just run into this problem. I know this thread is long out of date, but if anyone is looking to a solution for this, here it is…
You need to use two different blending methods Per Material. If your material is viewed by the RTT camera, then you need to alter the shader to be the following:
From the default blending:
Blend SrcAlpha OneMinusSrcAlpha
to this:
Blend SrcAlpha OneMinusSrcAlpha, SrcAlpha One

This will output the correct alpha from the RTT camera.

Hope this helps!