How to Transform Mesh Data From GLTF to OBJ Format

264 Views Asked by At

I need to transform the vertex and index data of a mesh from a GLTF file into that of an OBJ file for the purposes of applying V-HACD.

I notice they aren't too dissimilar by comparing the mesh data of a cube in both formats:

OBJ Verts GLTF Verts OBJ Index GLTF Index
-100 -1 1 3
-100 0 2 6
100 -0 0 0
-100 -100 3 10
100 -100 6 19
100 100 2 8
-100 0.375 7 23
-100 1 4 14
-100 0 6 20
-100 -1 5 15
100 -0 0 2
-100 -100 4 13
100 -100 6 18
-100 100 0 1
100 0.125 2 7
100 0.25 3 11
100 0 5 16
100 0 7 22
100 1 1 3
-100 -100 3 9
-100 -100 2 6
100 100 3 10
100 0.375 7 21
-100 0 6 19
_ _ 7 23
_ _ 5 17
_ _ 4 14
_ _ 5 15
_ _ 1 4
_ _ 0 2
_ _ 6 18
_ _ 4 12
_ _ 0 1
_ _ 3 11
_ _ 1 5
_ _ 5 16

When attempting to use the GLTF data V-HACD throws an assertion error:

i < m_dim[0] && i >= 0 && j < m_dim[1] && j >= 0 && k < m_dim[2] && k >= 0

I'm guessing the vertex ordering is incompatible.

0

There are 0 best solutions below