- Home /
Do I need to split my mesh up to properly UV texture it?
I'm procedurally generating meshes for my game and I have a few questions.
Say I have a cylinder with a top, bottom, and sides. I need to assign different UV values to the vertices shared by the top and sides. Does splitting up these vertices, so that there may be two in the same place, have any noticeable impact on performance or resource usage? Is there a better way to do this? Is this standard across all engines (do most game engines want you to split up your vertices like this)?
In addition to the questions above, do I need to split up my mesh into multiple mesh's (multiple mesh filters) to apply multiple materials to it? Can I keep the one mesh together and texture different triangles differently?
Answer by Benproductions1 · Mar 27, 2013 at 01:03 AM
To answer your first question: The only reason gameEngines split up some, but not other vertices, is because of Normal Interpolation
. If the vertices were combined, it would result in every edge being smoothed. When this is not a desired effect, the vertices are split. Unless your working in the millions, there is no noticeable difference.
For the second Question: You need to split up your mesh into submeshes in order to apply different materials to different parts. You can't have more than 1 Mesh Renderer on one object
Hope this helps :) Benproductions1
Alright, cool. If I want to have more than two different UV coordinates on one shared vertex do I need to split them up (I'm guessing this is a yes though considering if I wanted to have two different UV coordinates of the same texture I wouldn't really want a smooth edge)
It takes more memory to split the vertices - depending on how many things you store on a vertex it can have an impact on mobile devices. You do need to split for multiple uvs. You could us an atlas texture and uv coordinates to put multiple textures on different parts of the mesh (better performance) but then you can't swap the textures easily afterwards.
If you want different tints etc you could use a custom shader that uses vertex colours, second uvs, alpha values in the first texture etc to tell the shader to use a different texture for different parts of the model.
In the picture you can see my "shop" which has two textures. The window for the shop is chosen based on looking for special vertex colours and the underlying texture map is recoloured using a red/green/blue mapping.
$$anonymous$$y people are all one model and a single combined skinned mesh - they use a reference texture to colour different parts of their bodies different colours. They all use a base stripey texture which is mapped onto different clothing colours.
By multiple UVs you mean multiple UV values not multiple UV textures, right? Thanks, that really explained a lot btw :)
Your answer
Follow this Question
Related Questions
Problem Creating a 2D Mesh 1 Answer
Setting mesh.vertices to a 3-dimensional array 1 Answer
Help in understanding Mesh Generation 1 Answer
Mesh adaption 1 Answer
mesh-morph scaling badly 1 Answer