0
votes

My goal is to serialize Blender meshes to json and then parse json in my application. The problem I struggle with is the way the Babylon exporter parses my meshes. Let's take a simple cube:

enter image description here

After using Babylon.js 5.6.4, the indices part looks like shown below. If I understand correctly, every three indexes show one face of mesh (a triangle).

"indices":[0,1,2,3,4,5,5,0,2,4,6,0,6,3,1,2,3,5,0,6,1,3,7,4,5,4,0,4,7,6,6,7,3,2,1,3]

Thus, in my app, I parse it so I get 12 triangles. However, I think they are bugged.

0 :     ( 0 1 2 )
1 :     ( 3 4 5 )
2 :     ( 5 0 2 )
3 :     ( 4 6 0 )
4 :     ( 6 3 1 )
5 :     ( 2 3 5 )
6 :     ( 0 6 1 )
7 :     ( 3 7 4 )
8 :     ( 5 4 0 )
9 :     ( 4 7 6 )
10 :    ( 6 7 3 )
11 :    ( 2 1 3 )

If I were to draw a model with this indices, I would go with triangles 0, 11, 2 and then I would encounter an error - how can both triangle 11 and 5 be connected to the same vertex labeled as 3? Isn't it an incorrect cube?

enter image description here

1

1 Answers

0
votes

Works for me. I do not have the time nor faculties to the mental gymnastics, due to new year's eve already starting. See your file in.

I think what your issue might be is it does not look like a cube. Just add an 'edge split' modifier for flat shading.