This is a generative mesh - wireframe looks like this
But the shaded object looks like a tie dye tshirt
I've no idea what settings are causing it to look like this. These are the settings of the mesh renderer
This is a generative mesh - wireframe looks like this
But the shaded object looks like a tie dye tshirt
I've no idea what settings are causing it to look like this. These are the settings of the mesh renderer
It appears like you generated the mesh vertices, but did not generate any texture coordinates (aka uv map) for them. Texture coordinates are important, because they tell the renderer which part of the texture should be visible on which polygon of your 3d mesh.
So when you generate a mesh using the Mesh class, make sure that you don't just fill the .vertices
array but also the .uv
array with one Vector2
for each Vector3
in your vertices array.
mesh.SetUVs(0, vertices)
or do I need to do a more complex process? I also ran mesh.RecalculateNormals()
to get the normals, but this doesn't seem to have made any difference to the rendering.
\$\endgroup\$
Vector3
in your vertices array needs a corresponding Vector2
in your uv array. These Vector2's are pixel-coordinates on your texture and are used to determine which part of the texture is visible on which polygon. So the values depend on how exactly you want to apply your texture. There is no simple one-line shortcut for this. You will have to think about this for a bit.
\$\endgroup\$