For my new 3d game i need to use a software for modeling, texturing and lightmapping.. as max does all 3 very well and i had a basic know how of how do it i decided to use it for my game.. but as the engine that we use,  Edge Lib , only supports  3ds and ms3d and both didnt fit my needs i decided to use my own file format and use maxscript to export it..

Now studio max has a very different system for saving texture coordinates which ill have to say is very logical too.. Instead of having a 1-1 relationship between vertices and uvs like opengl has, studio max has indices for uvs too.. and a 1-1 relationship between faces.. this allows you to use different texture coordinates for the same vertex and hence there are no problems and allows you to smoothly texture curvy surfaces too.. many people have chosen different methods to tackle this problem, but i did this..

I create an array of unsigned shorts and use the vertex number as array index, and store the uv coordinate in them.. if there is a vertex which already has a uv in it, i create a new vertex at the end of this vertex array and assign it with this different uv coordinate.. this increases the size of the vertex array, but allows you to have multiple texture coordinates for the same vertex.. so at the end of the vertex array there are repeated vertices, but the uv array can also have the same number of elements hence allowing a 1-1 relationship..

 

Advertisements