I made a procedurally generated mesh and set values for uv and uv1 properties.
I wrote a surface shader that uses both sets of uvs.
The shader has two textures, and the mesh has a set of uvs for each one.
I should be able to switch between one and another by changing a weight between them.
Shader "MyShader" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
_ShineTex ("Shine (RGB)", 2D) = "white" {}
_ShineOpacity ("Shine opacity", Range (0,1)) = 0
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
#pragma surface surf Lambert
sampler2D _MainTex;
sampler2D _ShineTex;
float _ShineOpacity;
struct Input {
float2 uv_MainTex : TEXCOORD0;
float2 uv_ShineTex : TEXCOORD1;
};
void surf (Input IN, inout SurfaceOutput o) {
fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * (1-_ShineOpacity) + tex2D(_ShineTex, IN.uv_ShineTex) * _ShineOpacity;
o.Albedo = c.rgb;
o.Alpha = c.a;
}
ENDCG
}
Fallback "VertexLit"
}
This is not working, and by the render I can tell that uv_MainTex and uv_ShineTex are both using TEXCOORD0.
Any ideas about what’s happening?