Re: Offscreen Texture Alpha
Posted: 06 Apr 2019, 16:06
I added Blend Off, which I believe was already on as a default setting.
Re: doing the operation during object vs render target camera rendering... The reason I am applying this shader to the output texture instead of the rendered object is so that I am not required to change the many shaders used by different game objects! I'm honestly at a loss for how to make this work with Noesis.
Code: Select all
Shader "Noesis/Alpha Blended Premultiply" {
Properties{
_MainTex("RenderTexture", 2D) = "black" {}
}
Category{
Blend Off
Cull Off
Lighting Off
ZWrite Off
Fog { Mode Off }
SubShader {
Pass {
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
sampler2D _MainTex;
struct appdata_t {
float4 vertex : POSITION;
float2 texcoord : TEXCOORD0;
};
struct v2f {
float4 vertex : SV_POSITION;
float2 texcoord : TEXCOORD0;
};
float4 _MainTex_ST;
v2f vert(appdata_t v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.texcoord = TRANSFORM_TEX(v.texcoord,_MainTex);
return o;
}
fixed4 frag(v2f i) : SV_Target
{
fixed4 c = tex2D(_MainTex, i.texcoord);
c.r *= c.a;
c.g *= c.a;
c.b *= c.a;
return c;
}
ENDCG
}
}
}
}