Accessing uv without a texture

Hi, I’m in the middle of writing a few shaders, all based on vertex colors. In my water shader, I would like to be able to use the uv coords for some anmations, but I can’t find a way to access them without first adding a texture to the shader

the below code works as intended, but I would like to just access uv without having to add the _MainTex property.

struct Input {
  float4 color : COLOR;
  half2 uv_MainTex;
};

void surf (Input IN, inout SurfaceOutput o) {
  o.Albedo = IN.color.rgb;
  o.Alpha = IN.color.a + sin(_Time.y * IN.uv_MainTex.x) * IN.uv_MainTex.y;
}

alternative ways of saving values other than color in the mesh is also very welcome :slight_smile:

Thanks - Jannek

You wrote a Surface-shader. As the linked page explains, a Surface shader “is a code generation approach”. It’s a high-level language which does a lot stuff in the background. As far as i can tell you can’t prevent the compiler from creating the _MainTex variable since the “Surface Shader compiler then figures out what inputs are needed”.

You might be able to adapt the shader by looking at the compiled shader. If you don’t need automatic lighting and all that stuff you probably should write a “normal” (vertex + fragment) shader on your own.