[Closed] Per Face uv mapping
Could anyone help me on how this is done through max script i found a blender example
http://www.blender.org/forum/viewtopic.php?t=16046
Here is a sample model and obj but i cant get it into max.
Thanks so much in advance.
http://www.sendspace.com/file/ukvvd7
What I think needs to happen is i create the vertex points and the un uv mapped textures.
then i need to read each face in order starting at one and store those 3 vertex points so that the total vertex points i have in an array is the face count * 3. Then i should be able to apply the uv map to that resulting set of vertex points and merge any duplicate vertexes. Can someone tell me the best way to do this thanks so much in advance.
So, peer face maping means that every face has own 3 texture verts. It’s simple to do, genarally maping isn’t difficult if you have knowledge of map verts and face working in max.
Texture vertices count can be different than object vertices count. It’s caused that on one vertex can be based more than one face. But each face has only one, coresponding texture face.
Let’s create peer face mapping:
First way is easier, works for most geometry classes, but it can edit only mapping at default channel (usually 1)
setMesh object tVerts:yourUVverts -- set array of UV coords (3 peer face)
buildTVFaces object -- initialise map faces (creates map face for each object face)
for i=1 to object.numfaces do -- now set indices of map verts for each map face
setTVFace object [3*i-2, 3*i-1, 3*i]
update object
Second more advanced way dedicated for meshes:
meshop.setNumMaps object 2 -- set count of UV channels (up to 99)
meshop.setMapSupport object 0 true -- vertex colors
meshop.setMapSupport object 1 true -- map channel 1
meshop.setNumMapVerts newMesh 0 (3* object.numfaces)
meshop.setNumMapVerts newMesh 1 (3* object.numfaces)
meshop.setNumMapFaces newMesh 0 object.numfaces
meshop.setNumMapFaces newMesh 1 object.numfaces
for i=1 to 3*object.numfaces do
(
meshop.setMapVert newMesh 0 i [1.0, 0.5, 0.25] -- vertex color (if you need)
meshop.setMapVert newMesh 0 i [0.75, 0.5, 0] -- UV coord for this vert
)
for i=1 to object.numfaces do
(
meshop.setMapFace newMesh 0 i [3*i-2, 3*i-1, 3*i]
meshop.setMapFace newMesh 1 i [3*i-2, 3*i-1, 3*i]
)
update object
There maybe small mistakes, it’s 4 AM there
Thanks so much can you tell me what i am doing wrong here or how to implement the 1st method you mentioned i am sure once i understand that i can add the second method.
Thanks again i got it working
for j = 1 to Face_array.count do meshop.setMapFace msh 1 j [3j-2, 3j-1, 3*j]