medica512
medica512

Reputation: 41

Extract vertex data from an FBX file?

I'm trying to extract vertex and UV map information from a FBX file created with 3ds max 2010.

All i could get from the file are good vertex and polygon index data but wrong UV maps.

Can someone point me in a good direction or give me a tutorial?

Upvotes: 2

Views: 6805

Answers (1)

zezba9000
zezba9000

Reputation: 3383

Note that when you load Normals for a object that is perfectly smooth they index differently then when not smooth.

Here is a link to some code I have made to load a FBX file into system memory... thought it might help You want to look at "MedelProcess_Mesh.cpp" btw to answer some questions you might have. Hope this helps, remember I have no animation support in there.

SIMPLE ANSWER::

For UVs.

int uvIndex1 = mesh->GetTextureUVIndex(polyIndex, 0);
int uvIndex2 = mesh->GetTextureUVIndex(polyIndex, 1);
int uvIndex3 = mesh->GetTextureUVIndex(polyIndex, 2);
KFbxVector2 uv1 = uv->GetAt(uvIndex1);
KFbxVector2 uv2 = uv->GetAt(uvIndex2);
KFbxVector2 uv3 = uv->GetAt(uvIndex3);

For Verts.

int vertexCount = mesh->GetControlPointsCount();
KFbxVector4* vertexArray = mesh->GetControlPoints();

Upvotes: 2

Related Questions