- Home /
Apply Generated Texture to Mesh
Hey All, I'm currently having an issue applying my generated material to my mesh. At the moment, whenever I try to apply a generated or imported Texture to my mesh, it always returns a color within the spectrum of the Texture. So for a noiseMap, it returns gray:
But for others, it returns whatever color is mostly prevalent there. Any ideas on how to fix this? If I apply either of these textures to a cube for example, they render correctly.
Answer by Namey5 · Mar 16, 2020 at 05:03 AM
Make sure you also generate UVs for the mesh, otherwise all parts of the object will sample the same pixel of the texture;
Vector2[] uvs = new Vector2[4]
{
new Vector2 (0f,0f),
new Vector2 (1f,0f),
new Vector2 (0f,1f),
new Vector2 (1f,1f)
};
mesh.uv = uvs;
Your answer
Follow this Question
Related Questions
Baking vertices down to flat texture from shader 1 Answer
Texture doesn't appear on created through code mesh,Texture disappears when I enter play mode 0 Answers
Procedual quad doesnt display texture - only single color 1 Answer
How to overlap tiles in procedural meshes? 1 Answer
Procedurally Generated Mesh Texturing 0 Answers