0

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.

  • Vertex and index data is basically format-agnostic, it's how the graphics API represents a mesh. The same numbers can represent a cube in either format. I'm not sure where the specific numbers above come from... they are just cubes with different vertex coordinates and orders I think? But that difference is not inherent to a file format. – Don McCurdy Nov 05 '22 at 19:02
  • If you're creating glTF files I'd recommend sharing the code that generates them, and testing output against https://github.khronos.org/glTF-Validator/, perhaps to narrow down whether the glTF file you've created is valid or not. – Don McCurdy Nov 05 '22 at 19:03
  • @DonMcCurdy The code that produces the glTF file is the official plugin for blender from [KhronosGroup](https://github.com/KhronosGroup/glTF-Blender-IO). I validated the file with you link you provided. – Heraclitus Devotee Nov 05 '22 at 20:17
  • You'll have to see my first comment, then. If you're looking for an explanation of the numbers in that table, it's just two different, mostly arbitrary, ways to make a cube. There's no 'official' glTF or OBJ version of a cube. – Don McCurdy Nov 06 '22 at 21:09
  • @DonMcCurdy Well that seems to narrow down the problem to V-HACD then. Thank you for the help! – Heraclitus Devotee Nov 07 '22 at 00:05

0 Answers0