I have this shader , this is what the code looks like:
Shader "Hidden/FogOfWar"
{
Properties
{
_MainTex ("Main Texture", 2D) = "white" {}
_SecondaryTex ("Secondary Texture", 2D) = "white" {}
}
SubShader
{
Tags
{
"Queue" = "Transparent+1" // makes it sort using sorting layer and not default to z value
}
Pass
{
Blend SrcAlpha OneMinusSrcAlpha
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct v2f
{
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
};
v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = v.uv;
return o;
}
sampler2D _MainTex;
sampler2D _SecondaryTex;
fixed4 frag (v2f i) : SV_Target
{
fixed4 col = tex2D(_MainTex, i.uv);
col.a = 1 - col.r;
return fixed4(0,0,0,col.a);
}
ENDCG
}
}
}
I am trying to implement fog of war for a top down isometric game using this shader, it kinda works, this is how the looks like when rendered(I have a game object with completely red sprite to reveal area, and my input material is completely black):

Now I want to implement the same using shader graph this is how my shader graph looks like:

But I can't get it to work, i.e. it doesn't reveal the area I want it to reveal i.e.

PS: I realized if I use the non-shader graph shader on the reveal area and have the transperency to default it works(not sure why), i.e.
Shader "Hidden/FogOfWar"
{
Properties
{
_MainTex ("Main Texture", 2D) = "white" {}
_SecondaryTex ("Secondary Texture", 2D) = "white" {}
}
SubShader
{
Tags
{
"Queue" = "Transparent" // need this not to be +1 for shader graph to work
}
I would only like to rely on the shader genereted by the shader graph though

