View Full Version : UVW on custom mesh, help!

07 July 2011, 01:40 AM

I am relatively new to MaxScript, and have run accross what I hope is a simple problem! Basically I want to create a custom mesh and then UVW map it correctly, all within script.
For the sake of argument lets say the mesh is simply two squares next to each other, with the first cut diagonally bottom-left to top-right and the second cut top-left to bottom-right. This is what I have tried:

vertex_positions = #([0,10,0],[10,10,0],[20,10,0],[0,0,0],[10,0,0],[20,0,0])
faces = #([2,1,4],[4,5,2],[2,5,6],[6,3,2])

mymesh = mesh vertices:vertex_positions faces:faces
meshop.applyUVWmap mymesh #face

I then apply a Bitmap texture. Although the mesh is built OK, the problem lies in the orientation of the textures of the faces. If the texture on the first face is the right way up (ie. with the top in the +ve y direction) then the texture of the second face is 90degrees anticlockwise, when I need it to also be straight up.
I have deduced that the problem lies with the order that I choose the vertices to be made into a face ([2,5,6][6,3,2] for the second face), but I cannot think of a different order that will get the correct orientation.
I have also fiddled with the TVfaces function as follows:

meshop.buildMapFaces mymesh 1
getTVface mymesh 1

I feel that this has something to do with it, but am lost really. The values returned from getTVface seem to describe something similar to the order the face is made in, but not exactly. I get the numbers [7,1,8] back, but there are only 6 verteces so what does this mean!?

Any help would be greatly appreciated

CGTalk Moderation
07 July 2011, 01:40 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.