5
$\begingroup$

I'm writing a raytracer and I'm using the assimp library to load objects. I have an object's material specified in a .mtl file:

newmtl rightSphere
Ka 0.01 0.01 0.01
Kd 0.01 0.01 0.01
Ks 0.30 0.30 0.30
Tf 0.10 0.10 0.10
Ns 200
Ni 2.5
illum 7

and I'm trying to load this material. I've been mostly successful so far, for example I know that to extract the diffuse component (Kd), I can use

aiMesh *mesh = scene->mMeshes[i];
aiMaterial *mat = scene->mMaterials[mesh->mMaterialIndex];
aiColor3D color;
mat->Get(AI_MATKEY_COLOR_DIFFUSE, color);

using the identifiers specified in here. However, I've been unable to extract the Tf component. I understand that this component defines the coefficient of refracted light per color channel, and I need this value along with the index of refraction (Ni) to get it to work.

My question is: how can I get the Tf value?

$\endgroup$
2
$\begingroup$

AI_MATKEY_COLOR_TRANSPARENT is used to define the transparent colour and AI_MATKEY_REFRACTI is the refractive index.

$\endgroup$
  • $\begingroup$ That doesn't seem to work for me. In this example, I tried to use these identifiers but with no success. I also added the source .mtl file and the code I was trying to run with the output for clarification. $\endgroup$ – Michal Kučera Jul 3 '17 at 6:35
  • 1
    $\begingroup$ Unfortunately I didn't test with a .mtl file, the information was from browsing the header files, the 2 macros I posted are the only references to those material parameters I could find so this could possibly be a incomplete feature in Assimp. $\endgroup$ – PaulHK Jul 3 '17 at 7:35
  • $\begingroup$ That might very well be the case. I tried to find some document specifying which parameters are supported and which aren't, but no luck so far. Would you know of any alternative way to define and load a material in an external file? $\endgroup$ – Michal Kučera Jul 3 '17 at 7:43

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.