Multiple UV set not working in Surface shader ?

Here is what I want to do :
combine, in a shader, tiled diffuse AND light map with its own UV set AND Normal map with its own UV set.

Result I get: just like all the samplers use the lightmap uv set (#2) while I use 3 different uv sets in 3DSMAX.

Tried both in deferred and forward modes.

Shader "MyStuffs/BumpDiffuseLightMap" {
    Properties {
      _MainTex ("Texture", 2D) = "white" {}
      _LightMap ("LightMap", 2D) = "gray" {}
      _BumpMap ("Bumpmap", 2D) = "bump" {}      
    }
    SubShader {
      Tags { "RenderType" = "Opaque" }
      CGPROGRAM
      #pragma surface surf Lambert
	  
      struct Input {
          float2 uv_MainTex;
	  float2 uv_LightMap;
          float2 uv_BumpMap;		  
      };
      sampler2D _MainTex;      
      sampler2D _LightMap;
      sampler2D _BumpMap;
	  
      void surf (Input IN, inout SurfaceOutput o) {
          o.Albedo = tex2D (_MainTex, IN.uv_MainTex).rgb;      
	  o.Albedo *= tex2D (_LightMap, IN.uv_LightMap).rgb * 4;
          o.Normal = UnpackNormal (tex2D (_BumpMap, IN.uv_BumpMap));
      }
      ENDCG
    } 
    Fallback "Diffuse"
  }

I am confused…
Am I doing something wrong ?

Any hint ?

float2 uv_MainTex;
float2 uv_LightMap;
→ this is the same (1st) uv channel with possibility for different tiling and offset.

float2 uv2_BumpMap;
→ would use second uv channel.

There’s no 3rd uv channel in Unity.


I think you can encode additional uv channels via script into vertexcolors or a texture, but I haven’t tried that yet.

ok thank you for your feedback.
How does the engine knows uv_MainTex and uv_LightMap are the same ?
what is the convention for the uvX_Y naming?
Can’t find it in the documentation…

It’s in the first paragraph of the Surface Shader Input Structure section on this page. Basically “uvXY” where “X” is nothing or “2”, and Y is the name of the texture to pull the scaling and tiling from.

oopss … missed that …
Is there a plan at Unity to include more than 2 Uv sets ?
The vertex color trick can be used (even if I have no idea, at this time how I would do this) but it would be great for straightforward different UV for the normal map.

I don’t believe there’s an actual plan to include more UV sets. It’s been on the “maybe in the future” list for a few years, but I think Aras has yet to hear a compelling argument for prioritizing more than two UV sets.

Ok thank you. Let’s hope this feature will make its way to the feature list.

You can put it on feedback.unity3d.com, but given that it’s not already there I’d say it’s probably not a popular feature.

So we are still stuck into that 2 uvset limitation ?

I’ve found an issue into the standard shader with misorientation of nomalmaps of the detailed one, if the uv set orientation of UV island are not the same from UVset0 and 1.

look here please.