8

i use notepad++ to see the data structure of FBX model but i have some problems understanding it. Here is some info of a cube(side = 10) located in (0,0,0), can anyone tell me what do these members mean? THANKS!

Vertices: *24 {
a: -5,-5,0,5,-5,0,-5,5,0,5,5,0,-5,-5,10,5,-5,10,-5,5,10,5,5,10
} 
PolygonVertexIndex: *36 {
a: 0,2,-4,3,1,-1,4,5,-8,7,6,-5,0,1,-6,5,4,-1,1,3,-8,7,5,-2,3,2,-7,6,7,-4,2,0,-5,4,6,-3
} 
Edges: *18 {
a: 0,1,2,3,4,6,7,8,9,10,13,14,16,19,20,25,26,32
} 
Normals: *108 {
a: 0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,-        1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-   1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0
} 

UV: *24 {
a: 0,0,1,0,0,1,1,1,0,0,1,0,0,1,1,1,0,0,1,0,0,1,1,1
} 
UVIndex: *36 {
a: 9,11,10,10,8,9,8,9,11,11,10,8,4,5,7,7,6,4,0,1,3,3,2,0,4,5,7,7,6,4,0,1,3,3,2,0
} 
Christian Rau
  • 45,360
  • 10
  • 108
  • 185
yvetterowe
  • 1,239
  • 7
  • 20
  • 34
  • A more detailed explanation can be found here: https://banexdevblog.wordpress.com/2014/06/23/a-quick-tutorial-about-the-fbx-ascii-format/ – convert Nov 28 '22 at 12:46

3 Answers3

11

I think these assumptions are quite reasonable, though I'm not sure why the PolygonVertexIndex array contains negative values (it seems every third index of each triangle is negative). Maybe to indicate the last index of a polygon, so you can have polygons which need not be triangles.

The one with the negative value represents the last vertex indeed.

To find out witch vertex this is, you have to negate it and subtract 1 from that value.

For example, -4 represents 3 ((-4)*(-1) - 1)

lhan
  • 4,585
  • 11
  • 60
  • 105
Harlequin
  • 111
  • 1
  • 2
  • 1
    And this makes perfect sense, Thanks Autodesk... I guess we have to deal with this. – overlii Feb 06 '15 at 17:25
  • 1
    Now that I think about it the -1 is smart because otherwise you have a problem with index 0! – overlii Feb 06 '15 at 17:29
  • indeed, it is, is the last one on the polygon. The FBX can define multivertex polygons, and uses the (-N-1) to show wich one is the end. – diego.martinez Jun 26 '15 at 14:05
10

The negative vertex index indicates the end of the polygon. You can bitwise negate the negative index, to get the positive one.

In c this would be

posIndex = ~negIndex;
Robse
  • 131
  • 1
  • 3
10

Even with no knowledge of the FBX format you can at least make some very reasonable guesses:

  1. The 24 values under Vertices are the 8 vertices of the cube (with 3 values representing one vertex).

  2. The 36 values under PolygonVertexIndex are the vertex indices (referencing the values from Vertices) for the 12 triangles making up the 6 faces of the cube.

  3. The 24 values under Edges are the vertex indices of the 12 edges of the cube.

  4. The 108 values under Normals are the 36 normals for each of the triangle corners of the 12 triangles (with 3 values representing one normal vector).

  5. The 24 values under UV are 12 texture coordinates (with 2 values representing one texture coordinate pair).

  6. The 36 values under UVIndex are the texture coordinate indices (referencing the values from UV) for the 36 triangle corners of the cube.

I think these assumptions are quite reasonable, though I'm not sure why the PolygonVertexIndex array contains negative values (it seems every third index of each triangle is negative). Maybe to indicate the last index of a polygon, so you can have polygons which need not be triangles.

Christian Rau
  • 45,360
  • 10
  • 108
  • 185
  • yeah the "normals" are normals for the three vertices of 12 faces. But isn't the a vertex's normal computed by adding the normals of the faces connected with the vertex and then normalizing? I got quite confused with the normal of a vertex and the normal of a face. – yvetterowe Oct 12 '11 at 16:03
  • @yvetterowe The normals can be computed anyway you want and for a cube it is no good idea to average a vertex's adjacent face normals. The format seems to store a normal for each triangle corner (therefore 36 normals) and not for each triangle or for each vertex. This way the normals can be whatever they want (per-vertex, per-face or something in between), introducing duplicate normals as neccessary. – Christian Rau Oct 12 '11 at 16:07
  • 3
    regarding `Edges`, These are **not** vertex indices's, They are direct references to the PolygonVertexIndex array. Each edge is defined by that vertex and the next one in that face (if the index is < 0, it wraps around to the first index in that polygon). (I found this while writing an importer, if you load these values as edge-index-pairs you end up with scrambled edges all over the mesh) – ideasman42 Sep 02 '13 at 06:15