Jump to content
  • Advertisement
Sign in to follow this  
WebsiteWill

3D Studio Max vertex mess

This topic is 5003 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I don't mean to turn this into a Max forum but so far, the Max forums I visit don't reply to my questions. I'm still trying to export vertex and face data from a Max scene and I noticed something really strange. I created a Quad surface and converted to an editable mesh. I then ran a script that for each vertex it creates a text object at that vertex and uses the vertex number as it's text. The image below shows the results which are strange. It's as if all the vertices are placed at random. Surely there must be a way to arrange the vertices in a more neat manner? Or will I have to parse the output again in order to put the vertices in the order I desire? I can write a program for this easy enough but I'm hoping to not have to as it would involve multiple following steps after the data is exported. Anyone here face this issue who has a workaround for it? Thanks, Webby [Edited by - WebsiteWill on January 5, 2005 7:10:28 AM]

Share this post


Link to post
Share on other sites
Advertisement
Wouldn't it be much simpler and faster if they were? I thought it would help in the creating of triangle strips or fans. I might be missing something here. In fact, your reply tells me I'm definitely missing something here :)

I know it can be rendered since the faces contain the vertex data and it's just a matter of rendering each face but how do you group sets of faces into a single batch if you can't tell which faces are next to each other?

By the face, faces follow a similar though not exact pattern as vertices.

The faces seem to be laid out something like this which also makes no sense to me. You would think that they would follow some sort of pattern right?
9 10 11 12
3 4 7 8
1 2 5 6

Now that I think about it. I suppose the index buffer will control the order in which the mesh is rendered so I should be using that to form my lists and fans as well as material groups? I was thinking of arranging the vertices in the proper order but now I'm thinking the IB will be the correct method? Is this close?

Webby

Share this post


Link to post
Share on other sites
This data is still confusing me.
I realize that the connection data (faces) are just 3 points so it won't matter one bit where in a file those vertices are stored because they all get put into an array and the faces hold indexes into that array. But I'm still not sure how one would form triangle strip with data in this fashion.

I'm still not sure how you create texture sets with data like this unless you have to run through all the faces when you load the data and figure out which ones share the same material then group them together. Does someone know of any links that would explain this more clearly. All of my books that show how to load terrain data all start with data that is nicely ordered and not just a mish-mash of vertices and faces.

If it's just a matter of processing the data further after Max exports it then that's fine but it seems like there would be a way to make Max export better data.

Thanks,
Webby

Share this post


Link to post
Share on other sites
Why does it matter how are faces ordered in max? You should process them in your proggy and create format suitable for your engine (some kind of spatial hierarchy like BSP, AABB etc.).
I wrote simple script to export data from max to my custom format (text file similar to asc, only much smaller with more data [smile]).
If you want, I can post my code here (I wrote it in Max Script in Max 6 and I don't know whether it will run on older versions).

Share this post


Link to post
Share on other sites
yeah I did the same, write a maxscript for exporting that is. Very handy. Just export the indices and vertices and all else that you need and use that in your engine. How is ordered wont matter since youll use it lik its used in max.
-CProgrammer

Share this post


Link to post
Share on other sites
I don't really understand what your problem is, but i assume you do not see the advantages of using index buffers.

If the data is just for drawing normal meshes, just use the index buffer. There is a reason why meshes use the index buffer, because it eliminates duplicate vertices and speeds up rendering for most meshes.

When i started out, i totally didnt see the point of having a index buffer, infact it looked like a waste of memory to me.

If you look at a square, it is made up of 2 triangles.

2 triangles = 6 vertices

However 2 of these vertices are shared and are infact similar. By using index buffers, you will have 4 vertices and 6 indexes. This is assuming you are drawing Triangle Lists.

Index Buffers
4 vertices = 12 bytes * 4 = 48 bytes
48 + 6indexes = 54bytes

Not-using Index Buffers
12 bytes * 6 = 72 bytes

Now this is just a square, with higher polygon meshes, the difference will be much greater. Also i believe that mordern hardware can do vertex caching if index buffers are used.

If you were using Triangle strips, you could do without indexes and have just 4 vertices. However Triangle strips with indexes will still be more efficient for more complex meshes.

As far as i know, Max does'nt export it's data as Triangle Strips, and converting a mesh ordered as a Triangle List to TriangleStrips is not as trivial as it seems. However there are free libraries out there(nVidia has one) which can do this for you.

If you are using OpenGL, you can plug your data right in by using Vertex Arrays/VBOs. You need not reorder anything.

Share this post


Link to post
Share on other sites
It is, however, beneficial to the post-t&l cache if the vertices of adjacent triangles are close to each other in physical memory - such that face data nearby the current vertex is more likely to stay in the cache. This is what cache optimization tries to achieve, alongside with padding to cache address boundaries, and can make a profound difference in geometry processing speed.

MAX doesn't apparently care to optimize the vertex cache behavior during modeling, probably because it would take more time than the benefit would save.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!