4

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?

Michal Kučera
  • 353
  • 1
  • 8

1 Answers1

2

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

PaulHK
  • 2,282
  • 9
  • 11
  • That doesn't seem to work for me. In this [example](https://pastebin.com/dKC8xz4V), 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. – Michal Kučera Jul 03 '17 at 06:35
  • 1
    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. – PaulHK Jul 03 '17 at 07:35
  • 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? – Michal Kučera Jul 03 '17 at 07:43