- Home /
Splat Map shader no longer working in Unity 5
Hi we have a shader for our terrain splat maps that is no longer working even though it worked fine in Unity 4?
Here is the shader and the error we're getting: Too many texture interpolators would be used for ForwardBase pass (11 out of max 10) at line 16 (on )
I know that the issue is related to it trying to pass too many textures but i dont understand why this is now a problem and how best to correct this?
Any advice would be warmly welcome :)
Properties {
_Splat0 ("Layer 1", 2D) = "white" {}
_Splat1 ("Layer 2", 2D) = "white" {}
_Splat2 ("Layer 3", 2D) = "white" {}
_Splat3 ("Layer 4", 2D) = "white" {}
_Control ("Control (RGBA)", 2D) = "white" {}
}
SubShader {
Tags {"RenderType" = "Opaque"}
CGPROGRAM
#pragma surface surf Lambert
#pragma exclude_renderers xbox360 ps3
#pragma target 3.0
struct Input {
float2 uv_Control;
float2 uv_Splat0;
float2 uv_Splat1;
float2 uv_Splat2;
float2 uv_Splat3;
};
sampler2D _Control,_Splat0,_Splat1,_Splat2,_Splat3;
void surf (Input IN, inout SurfaceOutput o) {
fixed4 splat_control = tex2D (_Control, IN.uv_Control).rgba;
fixed3 lay1 = tex2D (_Splat0, IN.uv_Splat0) * splat_control.r;
fixed3 lay2 = tex2D (_Splat1, IN.uv_Splat1) * splat_control.g;
fixed3 lay3 = tex2D (_Splat2, IN.uv_Splat2) * splat_control.b;
fixed3 lay4 = tex2D (_Splat3, IN.uv_Splat3) * splat_control.a;
//o.Alpha = 0;
o.Albedo.rgb = lay1 + lay2 + lay3 + lay4;
}
ENDCG
}
Fallback "Diffuse"
}
adding "nolightmap" after the Lambert lighting setup seems to fix it but im not sure what this is doing? I am still seeing shadows which is good but I would prefer to understand what im disabling? Is this related to baked lighting like a beast light map?
Hi, did you ever find a workaround? I have the same problem but adding "nolightmap" will cause shadows disappear. Our game is for mobile so I'd like to avoid changing the shader model. Thanks!
Answer by ApeRage · Jun 24, 2015 at 10:42 AM
The shader model you are using won't support that many UV maps. Change #pragma target 3.0 to #pragma target 4.0
Shader model 4 is only supported by DirectX 11, ps4, and xboxOne though. Here is the link the info. http://docs.unity3d.com/Manual/SL-ShaderPrograms.html
this does work but the actual issue is that the GI function within the new standard shaders light rig is using additional texture interpolators compared to the legacy shaders from unity 4.