1
\$\begingroup\$

I have built an importer that retrieves necessary vertex data however I wish to be able to read texture file directories. How do I retrieve the texture file name?

\$\endgroup\$
1

1 Answer 1

2
\$\begingroup\$

FBX supports a whole range of texture properties per surface material: diffuse, specular, etc.. The property names are stored in static char* fields in SDK classs FbxSurfaceMaterial. You can get a pointer to such a material by iterating across all materials of an FbxNode using functions GetMaterialCount() and GetMaterial(index).

To load a texture, you first have to retrieve a valid FbxProperty from the FbxSurfaceMaterial by querying it with FindProperty(propertyName), then iterate over the number of "SrcObjects" using GetSrcObjectCount() and GetSrcObject() and for each of them retrieve the user data with GetUserDataPtr(). This user data contains the name of the texture. How you map that to your filesystem/packed data/ is up to you.

Keep in mind that most of the properties also have associated factor properties, and they can be queried with their associated names in exactly the same way. The factors are typically used to set material property weights in the lighting shader (such as specular, reflectiveness, ambient, emissive etc.. )

\$\endgroup\$
1
  • 2
    \$\begingroup\$ Cheers! The SDK can be so damn confusing. \$\endgroup\$
    – Tyson May
    Commented Oct 26, 2014 at 0:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .