How to use multiple UV maps in shaderlab?
I want to layer one texture over top of another on the same mesh, but map the textures to different UV maps.
The example in the Surface Shader Examples looks almost identical to what I want, but it seems that it uses the same UV coordinates as the original image, but multiplied by 2 to make it tile.
I will admit I am very new to shaderlab, but I am willing to put the work in and research: I just haven't seemed to be able to find the right documentation for what I want to do, or at least I do not understand how to use it...
I have achieved this result in blender this way, though I understand obviously there isn't a 1:1 conversion here.
As well, I do have it working with ShaderGraph, which is neat, but I need it to work using the internal Unity shader for the project I am working on, so unfortunately ShaderGraph is out. (not my choice!)
My understanding is that i would declare the UV maps under the Input struct like
struct Input{
float2 uv_MainTex : TEXCOORD0;
float2 uv_Detail : TEXCOORD1;
};
and then grab the textures from the Properties input by doing
sampler2D _MainTex;
sampler2D _Detail;
and then do whatever operations under the surface code.
I have also seen this answer but it doesn't really seem to solve the problem for me, it still doesn't seem to access my second UV map.
I do know that there is some confusion with how UV maps are used in HLSL vs in Unity, but generally speaking I'm not concerned about overwriting UVs with lightmaps or stuff like that, and if that is an issue I can just add dummy maps when I export from blender to put my custom UV map as the 4th index if that becomes an issue.
Anyway, the question becomes: How do I make one image map use a certain UV Channel and a second image use a second UV channel?
edit: This does need to be a lit shader, but it does not need to be a PBR material. A standard specular shader will work just fine for me.
Your answer
Follow this Question
Related Questions
2D image shader, 3D object UV mapping , Using good lightings,,, somebody help me! 0 Answers
What is the difference between Semantic POSITION and SV_POSITION both 0 Answers
How to add a MeshCollider to a plane that has been modified with a shader displacement map 1 Answer
How to correct texture mapping on arbitrary quadrilaterals ? 2 Answers
Shader Help : Add emission to my shader. 2 Answers