View Full Version : NVMeshMender and Submeshes

02-16-2003, 06:51 AM

I'm using Nvidia's MeshMender tool to build vertex tangents and binormals.

I'm using a custom mesh format which is as follows:

struct Mesh
unsigned int num_verts, num_uvs, num_norms, num_submeshes;

float *vertices;
float *uvs;
float *normals;

struct SubMesh
unsigned int num_faces;
unsigned int *faces;
SubMesh *submeshes;

My meshes are structured this way to take advantage of vertex arrays. Basically I activate a texcoord, normal, and vertex pointer for the mesh and then DrawElements for each of each submesh. I don't think this is uncommon.

Now the MeshMender tool inputs data with a single set of indices and spits out possibly duplicated vertices (hence different indices). This means I can't Munge() with a full index buffer built from the sum of all the submesh index buffers.

My first thought was to simply break the mesh off so that each submesh had a vertex buffer of its own. So simply call Munge() for each submesh with the same sets of verts, norms, coords, and change the index buffer. Vertices may be duplicated if they're shared by two submeshes (not very common) and I get the extra overhead of resetting the vertex/norm/uv pointers for each submesh when rendering.

MeshMender returns the full set (or more) of vertices not only the ones indexed so I'd need to rebuild the vertex and index buffer after the Munge()ing to not waste vertex buffer space.

This is the technique I'm opting for and implementing right now. Has anyone else had to deal with this before? Did you handle the situation differently?

Any other input is appreciated :-)

Thanks for reading,


02-17-2003, 03:09 PM
I went ahead and implemented what I described above and everything worked fine.

Now I have another question:

Does NVMeshMender modify the vertices in any other way apart for duplicating them?

A quick scan through the code didn't seem to indicate anything of the sort yet the data which I send to NVMeshMender returns modified.

Here's a quite obvious example.

Screenshot of the plain mesh not processed with NVMeshMender:

And here's the very same mesh processed by NVMeshMender:

The vertices which lied on the xz plane were unmodified (or at least apparently) while the rest were rotated 90 degrees on the x axis.

Any clue as to why? I've tried tweaking the Munge parameters but nothing there should be causing this.


// EDIT: are the image tags bust?

[This message has been edited by Cirrus (edited 02-17-2003).]