[Closed] model exporter troubles
hello there,
I’m working on a Maxscript model exporter for my game. it’s actually based on someone else’s code but I’ve had to modify it to suit the game and I now got a pretty good understanding of it.
however I’m having some problems with the uwv’s. wherever there’s a seam in the uwv’s I get a weird result, and I can’t seem to fix it.
here’s a pic of what I’m getting: (in-game vs. max)
you can see it works just fine where there are no seams. also it seems the model needs an Unwrap UWV modifier on top or else the exported uwvs are garbage.
and here’s the code I’m using to export the uwv’s:
for i=1 to obj.numfaces do
(
face = getFace obj i
for h=1 to 3 do
(
... (here goes some code to export the vertexes) ...
-- get and export vert uwvs
vert = (getTVert obj face[h])
-- 1-vert = we flip the uwv's in Y, the engine needs them that way
verty = 1-vert.y
vert2x = formattedPrint vert.x format:"#.6f"
vert2y = formattedPrint verty format:"#.6f"
format " % %" vert2x vert2y to:outFile
format "
" to:outFile
)--end of for each face index
)-- end of for each face
as you can see the code loops through all faces and inside that loop it loops for all 3 verts of each face, gets and exports the verts (I skipped that part of the code here) and its uwvs
I use formattedPrint because too often I get way too many numbers resulting in “e-008” stuff, and so I can take those away limiting to 6 decimals (what the engine likes)
any ideas?
thanks
2 guesses
-
I had once experienced that using Direct3D driver screwed up the uvs, when using OpenGL driver instead, the problem was gone
-
the map (diffuse?) isn’t using the default channel (1), maybe 2, 3, 4, and getTVert will only get the default channel’s ones so the output is garbage, but then it doesn’t explain why its correct when you put a Unwrap UVW modifier on top
I suggest you to try some other game engine packages, if the result is correct then its relatively more possible that your code is bugged