Multiple normal maps without blending

Hello!

My shader uses 5 textures. A mask with only RGBA informantion and the others are textures that will be rendered only in his respective channel. (ex: a texture placed in R will be showed only in the Red part of the mask painted in the object)

I use this to made terrain paint in my own meshes without use Unity’s terrain.

I’m having problems trying to implement individual normalmaps to each R G B A textures. The maximum I figure out to do is applying a normalmap that influences the whole object or blending them but none of that is what I want.

Anyone knows how can be done please??

My actual Shader do this:

My shader code: _Control is my mask with rgba info and _Splat0 to 1 are my terrain textures (And these bumps is my frustrate tentatives doing this part of the shader lol)

Shader "TerrainPaint/Lightmap-FirstPass" {
Properties {
    _Control ("Control (RGBA)", 2D) = "red" {}
    _Splat3 ("Layer 3 (A)", 2D) = "white" {}
    _Splat2 ("Layer 2 (B)", 2D) = "white" {}
    _Splat1 ("Layer 1 (G)", 2D) = "white" {}
    _BumpMap1 ("Bumpmap", 2D) = "bump" {}
    _Splat0 ("Layer 0 (R)", 2D) = "white" {}
    _BumpMap0 ("Bumpmap", 2D) = "bump" {}
    // used in fallback on old cardsus
    _MainTex ("BaseMap (RGB)", 2D) = "white" {}
    _Color ("Main Color", Color) = (1,1,1,1)
}
   
SubShader {
    Tags {
        "SplatCount" = "4"
        "Queue" = "Geometry-100"
        "RenderType" = "Opaque"
    }
CGPROGRAM
#pragma surface surf Lambert
struct Input {
    float2 uv_Control : TEXCOORD0;
    float2 uv_Splat0 : TEXCOORD1;
    float2 uv_Splat1 : TEXCOORD2;
    float2 uv_Splat2 : TEXCOORD3;
    float2 uv_Splat3 : TEXCOORD4;
    float2 uv_BumpMap0;
    float2 uv_BumpMap1;
};

sampler2D _Control;
sampler2D _Splat0,_Splat1,_Splat2,_Splat3, _BumpMap0;

void surf (Input IN, inout SurfaceOutput o) {
    half4 splat_control = tex2D (_Control, IN.uv_Control);
    half3 col;
       
    col  = splat_control.r * tex2D (_Splat0, IN.uv_Splat0).rgb;
    col += splat_control.g * tex2D (_Splat1, IN.uv_Splat1).rgb;
    col += splat_control.b * tex2D (_Splat2, IN.uv_Splat2).rgb;
    col += splat_control.a * tex2D (_Splat3, IN.uv_Splat3).rgb;
   
    o.Albedo = col;
    o.Normal = UnpackNormal (tex2D (_BumpMap0, IN.uv_BumpMap0));
    o.Alpha = 0.0;
   
   
}
ENDCG 
}

// Fallback to Diffuse
Fallback "Diffuse"
}

Frustrated result: it was not for the cobbles normalmap influence in the ground one.

Unity version: 4.3.1f

Thank you very much!

UPDATE

I just got how to separete normal maps in diferent parts, but now I stuck in two problems…
1 - Normal influence desapear around the shadows of the objects in the scene (picture below)

2 - It’s working only with two channels, if I place to calculate another (commented line 55 and 58) I got the error message: Too many interpolators used (maybe you want #pragma target 3.0?) at line 64

Shader "TerrainPaint/Lightmap-FirstPass" {
Properties {
    _Control ("Control (RGBA)", 2D) = "red" {}
    _Splat3 ("Layer 3 (A)", 2D) = "white" {}
    _BumpMap3 ("Bumpmap", 2D) = "bump" {}
    _Splat2 ("Layer 2 (B)", 2D) = "white" {}
    _BumpMap2 ("Bumpmap", 2D) = "bump" {}
    _Splat1 ("Layer 1 (G)", 2D) = "white" {}
    _BumpMap1 ("Bumpmap", 2D) = "bump" {}
    _Splat0 ("Layer 0 (R)", 2D) = "white" {}
    _BumpMap0 ("Bumpmap", 2D) = "bump" {}
    // used in fallback on old cardsus
    _MainTex ("BaseMap (RGB)", 2D) = "white" {}
    _Color ("Main Color", Color) = (1,1,1,1)
}
  
SubShader {
    Tags {
        "SplatCount" = "4"
        "Queue" = "Geometry-100"
        "RenderType" = "Opaque"
    }
CGPROGRAM
#pragma surface surf Lambert
//#pragma target 3.0
struct Input {
    float2 uv_Control : TEXCOORD0;
    float2 uv_Splat0 : TEXCOORD1;
    float2 uv_Splat1 : TEXCOORD2;
    float2 uv_Splat2 : TEXCOORD3;
    float2 uv_Splat3 : TEXCOORD4;
    float2 uv_BumpMap0;
    float2 uv_BumpMap1;
    float2 uv_BumpMap2;
    float2 uv_BumpMap3;
    //INTERNAL_DATA
  
};


sampler2D _Control;
sampler2D _Splat0,_Splat1,_Splat2,_Splat3, _BumpMap0, _BumpMap1, _BumpMap2, _BumpMap3;

void surf (Input IN, inout SurfaceOutput o) {
    half4 splat_control = tex2D (_Control, IN.uv_Control);
    half3 col;
      
    col  = splat_control.r * tex2D (_Splat0, IN.uv_Splat0).rgb;
    col += splat_control.g * tex2D (_Splat1, IN.uv_Splat1).rgb;
    col += splat_control.b * tex2D (_Splat2, IN.uv_Splat2).rgb;
    col += splat_control.a * tex2D (_Splat3, IN.uv_Splat3).rgb;
      
    o.Albedo = col;
    fixed3 normal_1 = (splat_control.r * UnpackNormal (tex2D (_BumpMap0, IN.uv_BumpMap0))) + (splat_control.g * UnpackNormal (tex2D (_BumpMap1, IN.uv_BumpMap1)));  
    //fixed3 normal_2 = (splat_control.g * UnpackNormal (tex2D (_BumpMap2, IN.uv_BumpMap2))) + (splat_control.a * UnpackNormal (tex2D (_BumpMap3, IN.uv_BumpMap3)));  
  
    o.Normal = normal_1;
    //           +normal_2;
    o.Alpha = 0.0;
  
  
}
ENDCG
}

// Fallback to Diffuse
Fallback "Diffuse"
}

Anyone knows how to solve these issues?

Normals influence how light diffuses into the surface, shadows are the absence of light so it only makes sense to get no effect when inside shadows.