Search code examples
c++assimp

Is Assimp able to load embedded texture of a 3mf file?


Today I found a 3mf file with an embedded texture (by embedded I mean, the .png texture is present in the 3mf zip).

As I'm currently learning Assimp librairy I tried to load it and it worked fine, mesh are loaded correclty however, the png texture is not loaded at all.

Is Assimp able to load embedded texture of a 3mf file?

In order to do some research before asking my question here, I did this kind of thing to log what kind of Material properties was loaded by assimp (when loading my 3mf file):

/** Loading material **/
aiString Path;
for (unsigned int i = 0 ; i < pScene->mNumMaterials ; i++) {
    const aiMaterial* pMaterial = pScene->mMaterials[i];
    if (pMaterial->GetTextureCount(aiTextureType_DIFFUSE) > 0){
        if (pMaterial->GetTexture(aiTextureType_DIFFUSE, 0, &Path, NULL, NULL, NULL, NULL, NULL) == AI_SUCCESS) {
            String FullPath =AppendFileName(GetFileFolder(Filename), String(Path.data));
            InsertTexture(FullPath,i);
        }
    } /*
        multiple else if to handle all different texture type 
    */
    }else{
        //If no texture type have match the current aiMaterial object then I log it to find what goes wrong
        for(int e = 0; e < pMaterial->mNumProperties; e++){
            aiMaterialProperty* aiMp = pMaterial->mProperties[e];
            LOG("Property number " + AsString(e) +" :");
            LOG("mKey : " + String((*aiMp).mKey.data));
            LOG("mSemantic : " + AsString((*aiMp).mSemantic));
            LOG("mIndex : " +  AsString((*aiMp).mIndex));
            LOG("mDataLength : " +  AsString((*aiMp).mDataLength));
            LOG("aiPropertyTypeInfo : " + AsString((int) (*aiMp).mType));
            String str = String((*aiMp).mData);
            LOG("mData count : " + AsString(str.GetCount()));
            LOG("---------------------------------");
        }
    }
}
/*************************/

As you can see I'm printing the Material to observe it deeper, however since my knowledge of assimp is really low, It's not helping me a lot !

Here you can find LOG of the 3mf file aiMaterial properties :All properties of aiMaterial of my 3mf file

after translating mKey / aiPropertyTypeInfo it seems like this both properties have nothing to do with Texture, it only have purpose of describing the way material/ light of my object should be calculated. Can someone confirm me ?


Solution

  • At the moment embedded textures are not supported in Assimp. Do you have the link to your file? We can try to add this feature. Just add a new issue here