0
\$\begingroup\$

How do I import tangent and binormal data per vertex from a FBX Mesh. I already know how to get Vertices, Normals and UVs but how would I get tangents and binormals?

For example this is how I would get a vertex.

int vIndex = MyFbxMesh->GetPolygonVertex(triangle, vertex);
FbxVector4 Vertex = MyFbxMesh->GetControlPointAt(vIndex);

What about tangents and binormals? I searched everywhere on the internet and looked in their documentation but I still can't find a way.

\$\endgroup\$
1
\$\begingroup\$

A good link was given here which explains how to get tangents and binormals.

\$\endgroup\$
  • \$\begingroup\$ Thank you for the link it helped me with what I wanted to do and everything worked. Thanks! \$\endgroup\$ – MisterArch Jun 21 '14 at 4:17
1
\$\begingroup\$

You may want to check the FBX SDK Documentation again. I managed to find GetElementBinormal(int index) and GetElementTangent(int index), which are both part of the FBXGeometryBase class, which FBXMesh inherits from. Have you tried these? Because, if the documentation is correct (which, given past experiences, I tend to expect the worst, even with wealthier companies' documentation), those should be what you would need, if the data for the tangents and binormals are included with the mesh data.

To extract the data from the objects these methods return, you'll need to use methods found in FbxLayerElementTemplate< Type >, namely GetDirectArray () and GetIndexArray (), unless you want to manipulate the actual array, which there are a few methods in that class for that, as well. You need to look up the inheritance tree with these things, since a lot of the functions will be generalized for multiple class types, and will operate in similar ways on a wide variety of starkly different data structures.

\$\endgroup\$
  • \$\begingroup\$ I did check this but I don't know how to use them. I tried figuring it out but I'm having a hard time. Have you got any idea? \$\endgroup\$ – MisterArch Jun 21 '14 at 0:56
  • \$\begingroup\$ That entirely depends what you want to do with them. I found some more info while digging, though. I'll update the answer. \$\endgroup\$ – Gurgadurgen Jun 21 '14 at 1:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.