[SOLVED] Model vertex order

Hello, I’m loading an obj-model and it looks like vertices are placed in the buffer in different order. How can I get the original order from loaded model?

How are you determining this?

If you are exporting from blender, at the bottom of the options is :

may be worth a try

1 Like

I just invoke in debugger

mesh.getBuffer(VertexBuffer.Type.Position).getElementComponent(0, 0)
mesh.getBuffer(VertexBuffer.Type.Position).getElementComponent(1, 0)
mesh.getBuffer(VertexBuffer.Type.Position).getElementComponent(2, 0)

and see that the results don’t correspond to obj’s vertices 0, 1, 2, but 1, 0, 3557

I don’t export from blender, I generate file in .obj format and I compare vertex order in that file and in the vertex buffer

At quick glance, it looks like the OBJLoader might be doing some reduction:

It’s possible that all of your original vertexes might not even be there.

It’s very strange to need this information, though. There may be a better way to do what you really want.

Well in that case it seems that I have to use custom obj loader and create mesh by myself
Thank you

But why is vertex order important? It seems like there might be better ways to do what you are really trying to do.

Be careful not to be a victim of the “inject things into my stomach” syndrome.

Maybe it really is critical to have a specific vertex order but it comes up so rarely (never?) that it’s worth looking into why it’s important to you and if there is a better way to achieve the final results. Relying on it certainly seems very fragile.

Well I perform some basis-specific linear transformations, that’s why order is significant
Now it’s ok, I’ve already used custom loader and manually initialized mesh, everything works now