0
$\begingroup$

I am loading an OBJ file using the ASSIMP library. Following is the MTL file associated with the obj file.

newmtl initialShadingGroup
Kd 0.50 0.50 0.50
Ka 0.09 0.09 0.09
Tf 1.00 1.00 1.00
Ns 10.0
map_Ka sphere_roughness.jpg
map_Kd sphere_albedo.jpg
map_Ks sphere_metallic.jpg
bump sphere_normal.jpg
disp sphere_bump.jpg
illum 7

I want to read the illum value so that I can choose an appropriate sharding model in my shaders. The code I'm using is

int shadingModel;
material->Get(AI_MATKEY_SHADING_MODEL, shadingModel);
std::cout << "ShadingModel: " << shadingModel<< std::endl;

But the output I'm getting is

ShadingModel: 2

when the value is 7. Is there something that I'm doing it wrong or is it the wrong way to retrieve the shading model. Thanks for your help!

$\endgroup$
0

1 Answer 1

1
$\begingroup$

According to the source (https://github.com/assimp/assimp/blob/b7df376836e36c4b6998ce95d97626e30f61c2f0/code/AssetLib/Obj/ObjFileImporter.cpp#L594) only illum values of 0, 1, 2 are supported:

    // convert illumination model
    int sm = 0;
    switch (pCurrentMaterial->illumination_model) {
    case 0:
        sm = aiShadingMode_NoShading;
        break;
    case 1:
        sm = aiShadingMode_Gouraud;
        break;
    case 2:
        sm = aiShadingMode_Phong;
        break;
    default:
        sm = aiShadingMode_Gouraud;
        ASSIMP_LOG_ERROR("OBJ: unexpected illumination model (0-2 recognized)");
    }
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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