Surface shader Normalmap lerp errors

I’ve created a surface shader that uses vertex colors to lerp different defuse textures with out a problem. I was able to add a single normal map to this shader just like in the documentation example and the single normal map worked correctly. So I added in lerps for multiple normal maps to go along with the diffuse textures and Unity just dosn’t like it.

Here is the shader with the single normal map that works fine

Shader “Blu/SurfShaderVertColorBlendNormalsBackup” {
Properties {
_MainTex (“Base (RGB)”, 2D) = “white” {}
_RedTex (“RedMasked (RGB)”, 2D) = “white” {}
_GreenTex (“GreenMasked (RGB)”, 2D) = “white” {}
_BlueTex (“BlueMasked (RGB)”, 2D) = “white” {}
_MainNormTex (“Base Normal”, 2D) = “bump” {}

}

SubShader {
Tags { “RenderType”=“Opaque” }
LOD 200

CGPROGRAM
#pragma surface surf Lambert vertex:vert

sampler2D _MainTex;
sampler2D _RedTex;
sampler2D _GreenTex;
sampler2D _BlueTex;
sampler2D _MainNormTex;

struct Input{
float2 uv_MainTex;
float2 uv_RedTex;
float2 uv_GreenTex;
float2 uv_BlueTex;

float2 uv_MainNormTex;

float3 vertColors;

};

void vert (inout appdata_full v, out Input o) {
o.vertColors = v.color.rgb;//grab the vertex colors from the appdata
o.uv_MainTex = v.texcoord;
o.uv_RedTex = v.texcoord;
o.uv_GreenTex = v.texcoord;
o.uv_BlueTex = v.texcoord;

o.uv_MainNormTex = v.texcoord;
}
void surf (Input IN, inout SurfaceOutput o) {
half4 texMain = tex2D (_MainTex, IN.uv_MainTex);
half4 texRed = tex2D (_RedTex, IN.uv_RedTex);
half4 texGreen = tex2D (_GreenTex, IN.uv_GreenTex);
half4 texBlue = tex2D (_BlueTex, IN.uv_BlueTex);
half4 finalBlend = lerp (texMain, texRed, IN.vertColors.r);
finalBlend = lerp (finalBlend, texGreen, IN.vertColors.g);
finalBlend = lerp (finalBlend, texBlue, IN.vertColors.b);

//half4 texMainNorm = tex2D (_mainNormTex, IN.uv_MainNormTex); Doc examples shows I don’t need this

o.Albedo = finalBlend.rgb;
o.Normal = UnpackNormal (tex2D (_MainNormTex, IN.uv_MainTex));
o.Alpha = finalBlend.a;
}
ENDCG
}
FallBack “Diffuse”
}

Here is the shader with the normal map lerp. I get Material doesn’t have a texture property ‘_GreenTex’
UnityEditor.DockArea:OnGUI() for every texture. I thought this could be due to changeing the shader the material is using so I created a new one andd applied the shader below to it. didn’t fix it.

Shader “Blu/SurfShaderVertColorBlendNormals” {
Properties {
_MainTex (“Base (RGB)”, 2D) = “white” {}
_RedTex (“RedMasked (RGB)”, 2D) = “white” {}
_GreenTex (“GreenMasked (RGB)”, 2D) = “white” {}
_BlueTex (“BlueMasked (RGB)”, 2D) = “white” {}
_MainNormTex (“Base Normal”, 2D) = “bump” {}
_RedNormTex (“RedMasked Normal”, 2D) = “bump” {}
_GreenNormTex (“GreenMasked Normal”, 2D) = “bump” {}
_BlueNormTex (“BlueMasked Normal”, 2D) = “bump” {}

}

SubShader {
Tags { “RenderType”=“Opaque” }
LOD 200

CGPROGRAM
#pragma surface surf Lambert vertex:vert

sampler2D _MainTex;
sampler2D _RedTex;
sampler2D _GreenTex;
sampler2D _BlueTex;
sampler2D _MainNormTex;
sampler2D _RedNormTex;
sampler2D _GreenNormTex;
sampler2D _BlueNormTex;

struct Input{
float2 uv_MainTex;
float2 uv_RedTex;
float2 uv_GreenTex;
float2 uv_BlueTex;

//float2 uv_MainNormTex; Normal maps will use diffuse map’s counterparts.

float3 vertColors;

};

void vert (inout appdata_full v, out Input o) {
o.vertColors = v.color.rgb;//grab the vertex colors from the appdata
o.uv_MainTex = v.texcoord;
o.uv_RedTex = v.texcoord;
o.uv_GreenTex = v.texcoord;
o.uv_BlueTex = v.texcoord;

//o.uv_MainNormTex = v.texcoord; Just use Deffuse UVs
}
void surf (Input IN, inout SurfaceOutput o) {
half4 texMain = tex2D (_MainTex, IN.uv_MainTex);
half4 texRed = tex2D (_RedTex, IN.uv_RedTex);
half4 texGreen = tex2D (_GreenTex, IN.uv_GreenTex);
half4 texBlue = tex2D (_BlueTex, IN.uv_BlueTex);
half4 finalBlend = lerp (texMain, texRed, IN.vertColors.r);
finalBlend = lerp (finalBlend, texGreen, IN.vertColors.g);
finalBlend = lerp (finalBlend, texBlue, IN.vertColors.b);

half4 texNormMain = tex2D (_MainNormTex, IN.uv_MainTex);
half4 texNormRed = tex2D (_RedNormTex, IN.uv_RedTex);
half4 texNormGreen = tex2D (_GreenNormTex, IN.uv_GreenTex);
half4 texNormBlue = tex2D (_BlueNormTex, IN.uv_BlueTex);
half4 finalNormBlend = lerp (texNormMain, texRed, IN.vertColors.r);
finalNormBlend = lerp (finalNormBlend, texNormGreen, IN.vertColors.g);
finalNormBlend = lerp (finalNormBlend, texNormBlue, IN.vertColors.b);

o.Albedo = finalBlend.rgb;
o.Normal = UnpackNormal (tex2D (finalNormBlend, IN.uv_MainTex));
o.Alpha = finalBlend.a;
}
ENDCG
}
FallBack “Diffuse”
}

here is the shader that dosn’t work
Shader “Blu/SurfShaderVertColorBlendNormals” {
Properties {
_MainTex (“Base (RGB)”, 2D) = “white” {}
_RedTex (“RedMasked (RGB)”, 2D) = “white” {}
_GreenTex (“GreenMasked (RGB)”, 2D) = “white” {}
_BlueTex (“BlueMasked (RGB)”, 2D) = “white” {}
_MainNormTex (“Base Normal”, 2D) = “bump” {}
_RedNormTex (“RedMasked Normal”, 2D) = “bump” {}
_GreenNormTex (“GreenMasked Normal”, 2D) = “bump” {}
_BlueNormTex (“BlueMasked Normal”, 2D) = “bump” {}

}

SubShader {
Tags { “RenderType”=“Opaque” }
LOD 200

CGPROGRAM
#pragma surface surf Lambert vertex:vert

sampler2D _MainTex;
sampler2D _RedTex;
sampler2D _GreenTex;
sampler2D _BlueTex;
sampler2D _MainNormTex;
sampler2D _RedNormTex;
sampler2D _GreenNormTex;
sampler2D _BlueNormTex;

struct Input{
float2 uv_MainTex;
float2 uv_RedTex;
float2 uv_GreenTex;
float2 uv_BlueTex;

//float2 uv_MainNormTex; Normal maps will use diffuse map’s counterparts.

float3 vertColors;

};

void vert (inout appdata_full v, out Input o) {
o.vertColors = v.color.rgb;//grab the vertex colors from the appdata
o.uv_MainTex = v.texcoord;
o.uv_RedTex = v.texcoord;
o.uv_GreenTex = v.texcoord;
o.uv_BlueTex = v.texcoord;

//o.uv_MainNormTex = v.texcoord; Just use Deffuse UVs
}
void surf (Input IN, inout SurfaceOutput o) {
half4 texMain = tex2D (_MainTex, IN.uv_MainTex);
half4 texRed = tex2D (_RedTex, IN.uv_RedTex);
half4 texGreen = tex2D (_GreenTex, IN.uv_GreenTex);
half4 texBlue = tex2D (_BlueTex, IN.uv_BlueTex);
half4 finalBlend = lerp (texMain, texRed, IN.vertColors.r);
finalBlend = lerp (finalBlend, texGreen, IN.vertColors.g);
finalBlend = lerp (finalBlend, texBlue, IN.vertColors.b);

half4 texNormMain = tex2D (_MainNormTex, IN.uv_MainTex);
half4 texNormRed = tex2D (_RedNormTex, IN.uv_RedTex);
half4 texNormGreen = tex2D (_GreenNormTex, IN.uv_GreenTex);
half4 texNormBlue = tex2D (_BlueNormTex, IN.uv_BlueTex);
half4 finalNormBlend = lerp (texNormMain, texRed, IN.vertColors.r);
finalNormBlend = lerp (finalNormBlend, texNormGreen, IN.vertColors.g);
finalNormBlend = lerp (finalNormBlend, texNormBlue, IN.vertColors.b);

o.Albedo = finalBlend.rgb;
o.Normal = UnpackNormal (tex2D (finalNormBlend, IN.uv_MainTex));
o.Alpha = finalBlend.a;
}
ENDCG
}
FallBack “Diffuse”
}

I get this error for every texture parameter
Material doesn’t have a texture property ‘_GreenTex’
UnityEditor.DockArea:OnGUI()
.

oops what was I thinking.

o.Normal = UnpackNormal (tex2D (finalNormBlend, IN.uv_MainTex));

Should be

o.Normal = UnpackNormal (finalNormBlend);