- Home /
UV affectation with multi submeshes
Hi, I have a serious problem with character texturing!
I’m using a character with only one mesh, and I want to apply the texture from 4 different pictures, I’ve the algorithm that allow me doing the texture correspondence (for each vertex in the mesh, the algorithm gives me : from witch picture I must get the texture and the UV coordinates on that pictures)
I’ve tried many methods but no one seems to give correct results in Unity, and now I’m working on that method:
- I added 04 Materials to the character object in the inspector
- I added 04 submeshes to the mesh (I don’t have the choice, it’s impossible to divide the mesh into 04 different meshes or different objects ) using :
mesh1.subMeshCount= 4;
- I affected the triangles array corresponding to each submesh using: mesh1.SetTriangles(triangRightTab,1);
- Using my algorithm -I talked about at the beginning- I changed the UV map to associate the uv coordinates to each vertex !!!!!!!!!!!!!!!!!!!!!!!!! like that
uvMapping[i] = new Vector2(x,y);
mesh.uv = uvMapping;
The problem is here, when I do that I’m talking with only one vertex array (the division of the mesh into submeshes don’t split the vertex table, it only concern the triangles table), so with these line, I can only tell to each vertex that his uv are (x,y) but I can’t tell him from witch picture (material) he will get them!!!!!!! So he is doing the mapping with only the material 0.
Am i missing anything, or is there a way to do that, help please it’s really taking me a lot of time. Thanks in advance
QUESTIONER PLEASE TIC$$anonymous$$ AN ANSWER- THAN$$anonymous$$S
Answer by Fattie · Jun 06, 2013 at 08:13 AM
Generally regarding mesh and working with UVs. Please check out these
http://answers.unity3d.com/questions/293607/tiling-uv-mapping.html
Please be sure to vote up useful answers - I love points ! :)
http://answers.unity3d.com/questions/433582/manual-uv-mapping-of-a-primitive-cube.html
http://answers.unity3d.com/questions/193695/in-unity-is-there-a-fast-way-to-find-nearby-triang.html
<-- critical information
http://answers.unity3d.com/questions/263302/vertices-array-in-mesh-vertices.html
Please read carefully this gotchya:
http://answers.unity3d.com/questions/417483/is-there-a-way-to-assign-meshverticesi-directly.html
It is critical to read and understand this:
http://answers.unity3d.com/questions/315059/how-to-improve-performance-while-generating-extrud.html
please check out some of these
http://answers.unity3d.com/questions/15832/how-to-create-a-procedural-mesh-with-multiple-mate.html
http://answers.unity3d.com/questions/292497/number-of-materials-on-a-model.html
http://answers.unity3d.com/questions/312492/submesh-creation-from-script.html
http://answers.unity3d.com/questions/38414/multiple-materials-for-multiple-submeshes.html
http://answers.unity3d.com/questions/22209/why-is-it-possible-to-add-additional-materials-to.html
I may misunderstand you, but it's this simple:
change the texture.
it's just that simple.
it would be - unbelievable - to try to do UV mapping in Unity (why?)
Simply open Cheetah3D, Blender or whatever .. or for professional use something like this http://www.polygonal-design.fr/e_unfold/features.php .. and make up the four versions of your character.
then in Unity just change the texture.
Thanks for your replay I alredy do the UV mapping using unity! my project is to assign the texture in an automatic way, it's a very complicated project i know, so i cant use a modeler like blender or another, i need to do all the work using unity and just to be more clear, i don't want to use different characters with different textures, but one character whith four texture parts (part 1 of the mesh with the texture from the material 1, part 2 of the mesh with the texture from the material 2... ) do you have any idea!
the fact is that i want to make an automatic real human texture mapping (from 4 different view pictures) on a 3D human avatar, and for some reason such as i'm makin a real time deformation on the final avatar, it's really not possible to divide the mesh it must stay one single mesh
i hope i'm more clear, and thaks in advance for your response
i dont have a problem with program$$anonymous$$g it, i'm done with all the aspect, i just need to a way to use different uv map (to adress different materials) for each set of triangles (submeshes) --> for now it took always the first material texture for all the submeshes (see the picture below)
thank you, I've seen that, and it's what i did but what that "assign materials with Renderer.materials" means, how to do it? and if i assign them, when i change the mesh.uv, is by that change of the uv map, i can tell that the u and v coordinates i give for the vertex i are from the first material, the second ...