Question

I'm using the three.js model exporter with Blender, and I want to parse the produced file into C++. Getting the data in is no issue, but I don't understand the format they use for the faces. I have tried multiple models and the format is always like this triangulated cube example :

8 Verts 12 faces

"vertices" : [1,-1,-1,1,-1,1,-1,-1,1,-1,-1,-1,1,1,-1,0.999999,1,1,-1,1,1,-1,1,-1],

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

There are 34's and 0's at even intervals seemingly blocking in two faces. At the beginning of the list of faces it seems like you have a 34 (no idea why it's that number), then a face {0,1,2}, then zero, and then another face {0,1,2}, then back to the 34 and this repeats. I also have no clue why this face is repeated here. I also can't figure out why there seems to be 24 faces represented here, when there are only 12 faces in the model.

Does anyone have any idea what the logic is behind this format?

Was it helpful?

Solution

Everything you ever wanted to know about the three.js JSON Model Format 3.1 can be found in this three.js Wiki article: https://github.com/mrdoob/three.js/wiki/JSON-Model-format-3.1

three.js r.57

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top