Skip to main content
GameDev.net gamedev.net
🔒 Locked

3ds max script texture export problem

Started by Raeldor Dec 5, 2005 at 7:14 PM 2 replies 750+ views
Original Post
Raeldor
Raeldor
I am trying to export my model using 3ds max maxscript, but I am finding that for a mapvert it can be attached to one OR MORE meshverts. This seems to go against what the documentation says. Does anyone know how I can find which meshvert belongs to a mapvert? Thanks
bzroom
bzroom


I dont know anything about the scripting language but it seems logical that you would think about it the other way around. While exporting your mesh points you'll have an index or pointer to the associated texture coordinate. Since a mesh point would only have 1 texture coordinate, where as the same texture coordinate could apply to many mesh points (per texture).

So consider if you would have asked:

Does anyone know how I can find which mapvert is associated with a meshvert?
Teknofreek
Teknofreek
Actually, that's not quite true. A mesh vertex in Max can have more than one texture coordinate. For that matter, it can have more than one normal, more than one vertex color, and so on. I don't have time to go into why, but here's what you need to know. The ONLY thing that has a one-to-one correlation is that for every mesh face, there is a matching map face. The indices of each face allows you to match them up.

So, what you need to do is loop through each mesh face and get the mesh vertices it uses. You can then get their position, normal, etc. Then, get each map face(one for each uv set), and get the map verts associated with that face. Now, for each triangle you will have three positions, normals, uv's, etc.

If you want to optimize the vertices, you can do so at the end. To do this, check to see if any verts have identical components(pos,normal,uv,etc) and then pull the duplicates out of the list and update your indices. I recommend that you DO NOT try to optimize your verts until the end...it will drive you mad if you do.

Good luck!

-John
John
Raeldor
Raeldor
Quote:
Original post by Teknofreek
Actually, that's not quite true. A mesh vertex in Max can have more than one texture coordinate. For that matter, it can have more than one normal, more than one vertex color, and so on. I don't have time to go into why, but here's what you need to know. The ONLY thing that has a one-to-one correlation is that for every mesh face, there is a matching map face. The indices of each face allows you to match them up.

So, what you need to do is loop through each mesh face and get the mesh vertices it uses. You can then get their position, normal, etc. Then, get each map face(one for each uv set), and get the map verts associated with that face. Now, for each triangle you will have three positions, normals, uv's, etc.

If you want to optimize the vertices, you can do so at the end. To do this, check to see if any verts have identical components(pos,normal,uv,etc) and then pull the duplicates out of the list and update your indices. I recommend that you DO NOT try to optimize your verts until the end...it will drive you mad if you do.

Good luck!

-John


That's great info. Thanks for clearing up my confusion.

All the best.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.