graphics3dblender.obj

Index of vertex position in .obj file higher than number of given vertices


I'm working on .obj importer and I've created a test .obj file in Blender to see if my importer can work with it. Unfortunately, I get out of range exceptions because my model is riddled with vertex indices that are out of range.

For example, in the mesh "Doors" there are 120 vertices, but you can see that down in the submesh, indices that are mentioned are a lot higher (146, 147, 149...).

My .obj file is here. Does anybody know why are these indeces higher than the number of vertices or how to handle that?


Solution

  • Ok, I found out the answer. It turns out that submeshes in .obj files index vertex positions, texture coordinates, and normals on a global scale. So vertex at index 156 in submesh of 2nd mesh is 156th vertex counting from the first vertex of the first mesh. I don't know why do they do it like this :(.