Hey I’m writing a surface shader that needs to use UV2 on a model, however the texture doesn’t appear to be using the uvs at all when I apply them to the model.
Shader "Custom/shaderEnvironment" {
Properties {
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
[Toggle(TOGGLE)] _DetailToggle ("Enable Primary Detail", Float) = 0
_DetailTex ("Primary Detail (RGB)", 2D) = "white" {}
[Toggle(TOGGLE2)] _Detail2Toggle ("Enable Secondary Detail", Float) = 0
_Detail2Tex ("Secondary Detail (RGB)", 2D) = "white" {}
[Toggle(TOGGLE3)] _Detail3Toggle ("Enable Micro Detail", Float) = 0
_Detail3Tex ("Micro Detail (RGB)", 2D) = "white" {}
_Lightmaps ("Lightmaps", 2D) = "black" {}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
#pragma surface surf Standard fullforwardshadows
#pragma target 3.0
#pragma shader_feature TOGGLE
#pragma shader_feature TOGGLE2
#pragma shader_feature TOGGLE3
sampler2D _MainTex, _DetailTex, _Detail2Tex, _Detail3Tex, _Lightmaps;
struct Input {
float2 uv_MainTex;
float2 uv2_LightmapTex;
};
half _Glossiness;
half _Metallic;
fixed4 _Color;
UNITY_INSTANCING_CBUFFER_START(Props)
UNITY_INSTANCING_CBUFFER_END
half4 detailDouble(half4 albedo, half4 detail)
{
#ifdef TOGGLE
return ((albedo.a)*(albedo*detail)*2)+(albedo*(1-albedo.a));
#else
return albedo;
#endif
}
half4 detail2Double(half4 albedo, half4 detail)
{
#ifdef TOGGLE2
return ((1-albedo.a)*((albedo*detail)*2))+(albedo*albedo.a);
#else
return albedo;
#endif
}
half4 detail3Double(half4 albedo, half4 detail)
{
#ifdef TOGGLE3
return (albedo*detail)*2;
#else
return albedo;
#endif
}
void surf (Input IN, inout SurfaceOutputStandard o) {
fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
fixed4 d = tex2D (_DetailTex, IN.uv_MainTex*100);
fixed4 d2 = tex2D (_Detail2Tex, IN.uv_MainTex*30);
fixed4 d3 = tex2D (_Detail3Tex, IN.uv_MainTex*12);
fixed4 lm = tex2D (_Lightmaps, IN.uv2_LightmapTex);
c = detailDouble(c,d);
c = detail2Double(c,d2);
c = detail3Double(c, d3);
o.Emission = lm.rgb;
o.Albedo = c.rgb;
o.Metallic = _Metallic;
o.Smoothness = _Glossiness;
o.Alpha = c.a;
}
ENDCG
}
FallBack "Diffuse"
}
Does anyone know what the issue is? Thank you.