- Home /
Question by
hss · Mar 12, 2012 at 07:56 AM ·
procedural meshsurface shaderuvs
Surface Shader Ignoring Mesh UVs
I am using the Mesh object to procedurally create meshes but my very simple Surface Shader is ignoring my UVs that I set using mesh.uv via script. My mesh's UVs are correctly created to tile the texture, but the shader ignores the UVs and stretches the texture over the entire mesh.
Do I need to take any extra steps to get the shader to properly use the UVs in the Mesh object?
Shader "example/UVs" {
Properties {
_MainTex ("Texture", 2D) = "white" {}
}
SubShader {
Tags { "RenderType" = "Opaque" }
CGPROGRAM
#pragma surface surf Lambert
struct Input {
float2 uv_MainTex;
};
sampler2D _MainTex;
void surf (Input IN, inout SurfaceOutput o) {
o.Albedo = tex2D (_MainTex, IN.uv_MainTex).rgb;
}
ENDCG
}
Fallback "Diffuse"
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613065027im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
mesh.uv question 1 Answer
How to fill out a procedurally generated mesh with quads of varying sizes? 0 Answers
Procedural Mesh UV Problem (UVs 'mirrored' instead of 'repeating') 0 Answers
Is it safe to assume that all platforms can support a mesh with 4 sets of UVs ? 0 Answers
Procedural Mesh UV problem 0 Answers