Hi
Shader compile error!
Please take a look at what the problem of this code.
Shader "Fog of War/4TexturesDiffuseFastFow"
{
Properties
{
_Color ("Main Color", Color) = (1,1,1,1)
_Layer1 ("Layer1 (RGB)", 2D) = "white" {}
_Layer2 ("Layer2 (RGB)", 2D) = "white" {}
_Layer3 ("Layer3 (RGB)", 2D) = "white" {}
_Layer4 ("Layer4 (RGB)", 2D) = "white" {}
_MainTex ("Mask (RGB)", 2D) = "white" {}
}
SubShader
{
Tags
{
"SplatCount" = "4"
"Queue" = "Geometry-100"
"RenderType" = "Opaque"
}
CGPROGRAM
#pragma surface surf Lambert exclude_path:prepass noforwardadd halfasview novertexlights approxview
sampler2D _MainTex;
sampler2D _Layer1, _Layer2, _Layer3,_Layer4;
fixed4 _Color;
sampler2D _FOWTex0, _FOWTex1;
uniform float4 _FOWParams;
uniform half4 _FOWUnexplored;
uniform half4 _FOWExplored;
struct Input
{
float2 uv_MainTex : TEXCOORD0;
float2 uv_Layer1 : TEXCOORD1;
float2 uv_Layer2 : TEXCOORD2;
float2 uv_Layer3 : TEXCOORD3;
float2 uv_Layer4 : TEXCOORD4;
float2 fog : TEXCOORD5;
};
void vert (inout appdata_full v, out Input o)
{
UNITY_INITIALIZE_OUTPUT(Input, o);
float4 worldPos = mul (_Object2World, v.vertex);
o.fog.xy = worldPos.xz * _FOWParams.z + _FOWParams.xy;
}
void surf (Input IN, inout SurfaceOutput o)
{
fixed4 Mask = tex2D(_MainTex, IN.uv_MainTex);
half4 col;
col = Mask.r * tex2D (_Layer1, IN.uv_Layer1);
col += Mask.g * tex2D (_Layer2, IN.uv_Layer2);
col += Mask.b * tex2D (_Layer3, IN.uv_Layer3);
col += Mask.a * tex2D (_Layer4, IN.uv_Layer4);
half4 fog = lerp(tex2D(_FOWTex0, IN.fog), tex2D(_FOWTex1, IN.fog), _FOWParams.w);
//col = lerp(lerp(col * _FOWUnexplored, col * _FOWExplored, fog.g), col, fog.r); <-- this code problem
o.Albedo = col.rgb;
o.Alpha = col.a;
}
ENDCG
}
}