2

According to the FBX SDK official document, a FbxMesh contains an "IndexArray" to the materials, but it didn't clearly say whether if it's an index to the materials that attached to the parent node, or an index to the materials of the entire scene (which can be accessed through FbxScene)

So which case was it?

I thought it should be the index to the materials of the entire scene, but according to the example in the official document, it's the index to the materials of the parent node. But if THAT is the case however, then:

Since one mesh can be attached to multiple nodes, and different nodes can have different materials attached, does that means that one mesh can have different materials when referenced by different nodes? Is this intentional?

What I believed:

FbxScene* scene;
FbxMesh* mesh;
FbxLayerElementMaterial* layerElementMaterial = mesh->GetElementMaterial();
if (layerElementMaterial ->GetMappingMode() == FbxLayerElement::eAllSame)
{
    int index = layerElementMaterial->GetIndexArray()[0];
    FbxSurfaceMaterial* material = scene->GetMaterial(index);
}

What the official document sugguested:

FbxNode* node;
FbxMesh* mesh;
FbxLayerElementMaterial* layerElementMaterial = mesh->GetElementMaterial();
if (layerElementMaterial ->GetMappingMode() == FbxLayerElement::eAllSame)
{
    int index = layerElementMaterial->GetIndexArray()[0];
    FbxSurfaceMaterial* material = node->GetMaterial(index);
}
wd357dui
  • 135
  • 1
  • 8

0 Answers0