Sign in to follow this  

Wow What a Vert Buff Ride!

This topic is 4224 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

Man oh man, it’s been driving me nuts, but I finally figured out part of it. In other posts, I was asking about why the data in the index buffer looked wrong, and I discovered through the post it was due to the index buffer being 16 bit instead of 32 bit. Then I started messing with the vertex buffer, and didn’t realize every mesh within the hierarchy of my single X model can have a different size, from 24 or 32 bytes, or who knows what else. I assume this is because some of these have normals and color and others don’t? (I used mesh-> GetNumBytesPerVertex() if anyone is interested) I almost have this thing working the way I need, now for the question: I have two different .X models, each with a clone of the same simple poly mesh (unattached to the rest of the model). This poly is in the hierarchy and I can filter it out based on its name to perform a special task. The shape of the poly is important to me, and it’s the same shape in my two sample models (it’s a clone). The difference is its location. It might be turned and moved to different places in each model, but otherwise, it’s the same. When I export the X model, can I assume the triangles for that poly will always be exported in the same order? I mean, take the simple case of a square with two triangles; can I assume it’ll always export tri 1 then tri2, not the other way around? They are after all the same poly in both models. I guess this is a question more for the exporter? I’m using the latest panda exporter for 3dsmax 7. You see I have two needs, I need the poly and all its tri’s for part of my process, and I need the first tri in both poly’s for the other part of my process, but they MUST be the same tri, and I’m not sure that’s what I’m seeing. Any comments would be appreciated. Thanks

Share this post


Link to post
Share on other sites

What is this need of having triangles in the same order ?

I'd say that triangles come usually in the same order from an exporter but if they do some sort of optimizing or stripping then there is possibility that 1st triangle isn't always the 1st triangle.

Even vertices can be in different order if optimized (this again depends on the triangle order).

Can you be tell us what you are after and perhaps we can find another way of doing it ?

Usually meshes are of different size, but from the numbers (24-32) you provide us it sounds that you are talking about the size of a single vertex. Yes, the size differences come from different vertex properties such as texture coordinates, normals, tangents etc.

Best regards

Share this post


Link to post
Share on other sites
Quote:
I assume this is because some of these have normals and color and others don’t? (I used mesh-> GetNumBytesPerVertex() if anyone is interested)
Different GetNumBytesPerVertex() will mean a different vertex format, but multiple formats can all have the same size so its by no means a guarantee. Ideally you should use GetDeclaration() to inspect the vertex format if you need details...


Unless you have access to the source code for the exporter and loader then I wouldn't guarantee anything about a fixed ordering. You will probably get what you want, but as soon as any sort of optimization kicks in then that potentially goes straight out the window...

If you specifically need to identify parts of your mesh then you should consider attaching additional data to it. I don't know quite how far you'll get with stock .x templates/exporters, but "dummy" objects are often used to indicate markers on a mesh. They'll be used by the game to place weapons/items, but never actually rendered. Equally you could possibly use some sort of per-vertex tag (e.g. a special diffuse/specular colour) and run a search on that at load time...

hth
Jack

Share this post


Link to post
Share on other sites

This topic is 4224 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this