can anyone explain the FBX format for me?

六月ゝ 毕业季﹏ 提交于 2019-12-23 11:46:36

问题


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
} 

回答1:


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.




回答2:


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)




回答3:


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;


来源:https://stackoverflow.com/questions/7736845/can-anyone-explain-the-fbx-format-for-me

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!