- Home /
How to use 2nd uv set for base texture
Hi friends, I have a racing track which i'm using for one different lighting condition, and now i want to use the same scene for another lighting condition, so i can assign different material which uses second uv set for diffuse channel. If i make swap uvs option enabled in fbx then the uvs will be change for the first track also. So is there any other way to use 2n uvset for a model without changing in fbx settings??
you probably need to use a new mesh or shader/material. a new shader could be very sticky, as hidden unity effects are applied etc and you may need to rebuild these, so easier to copy your mesh and swap uv1 to uv2 there. mesh building is surprisingly fast so you could do this runtime if filesize is an issue.
Hi thnx for ur reply, I can save the scene as another one, but i want to use only one fbx. I read that there is some possibility with shader which uses only the second UV set for diffuse channel. Is it possible to get that with shader?? The reason why i am asking without changing the fbx is, i wanted my level design not to be changed.
Hi Girish, here is a shader that uses the other uv set.
I hope it helps.
Properties {
_Color ("Color", Color) = (1,1,1,1)
_$$anonymous$$ainTex ("Albedo (RGB)", 2D) = "white" {}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_$$anonymous$$etallic ("$$anonymous$$etallic", Range(0,1)) = 0.0
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
Cull Back
CGPROGRA$$anonymous$$
// Physically based Standard lighting model, and enable shadows on all light types
#pragma surface surf Standard fullforwardshadows
// Use shader model 3.0 target, to get nicer looking lighting
#pragma target 3.0
sampler2D _$$anonymous$$ainTex;
//float4 _$$anonymous$$ainTex_ST;
half _Glossiness;
half _$$anonymous$$etallic;
fixed4 _Color;
struct Input {
float2 uv_$$anonymous$$ainTex;
float2 uv2_$$anonymous$$ainTex;
};
void surf (Input IN, inout SurfaceOutputStandard o) {
// Albedo comes from a texture tinted by color
fixed4 c = tex2D (_$$anonymous$$ainTex, IN.uv2_$$anonymous$$ainTex) * _Color;
o.Albedo = c.rgb;
// $$anonymous$$etallic and smoothness come from slider variables
o.$$anonymous$$etallic = _$$anonymous$$etallic;
o.Smoothness = _Glossiness;
clip(c.a);
o.Alpha = c.a;
}
ENDCG
}
}
I don't know whether I reccomend this, particularly if you're new to shaders, but good luck.
Your answer
