I’m having an error where it says “Parser is hopelessly lost” on CGPROGRAM line. This only happens when I declare the “float2 uv2_OverlayTex” variable. I don’t understand why this is, because in the Surface Shaders documentation, it says ‘Texture coordinates must be named “uv” followed by texture name (or start it with “uv2” to use second texture coordinate set).’ Why would it give me an error when doing exactly that? Is there something wrong with my approach? The texture name is “_OverlayTex”, so the second uvs must be “uv2_OverlayTex”, right?
So you know, the code is set up to have a second texture set to be an overlay (to use Photoshop terminology) on the main texture. I’m attempting to use different tiling for the second texture as I want it to be higher resolution, like a detail map. Thanks for any help you can offer!
Shader "Custom/Overlay Texture" {
Properties
{
_Color ("Main Color", Color) = (1,1,1,1)
_MainTex ("Texture", 2D) = "white" {}
_OverlayTex ("Overlaid Texture (RGBA)",2D) = "white" {}
}
SubShader
{
Tags { "RenderType" = "Opaque" }
CGPROGRAM
#pragma surface surf Lambert
sampler2D _MainTex;
sampler2D _OverlayTex;
fixed4 _Color;
struct Input
{
float2 uv_MainTex;
float2 uv_BumpMap;
float2 uv2_OverlayTex
};
void surf (Input IN, inout SurfaceOutput o)
{
fixed4 basecol = tex2D (_MainTex, IN.uv_MainTex);
fixed4 overlaycol = tex2D (_OverlayTex, IN.uv_MainTex);
o.Albedo = basecol * _Color * overlaycol;
o.Alpha = basecol.a;
}
ENDCG
}
//Fallback "Diffuse"
}