Author Topic: MTL File Interpretation  (Read 468 times)

0 Members and 1 Guest are viewing this topic.

Offline Furniture_Guy

  • Full Member
  • ***
  • Posts: 132
    • Virco Educational Furniture
MTL File Interpretation
« on: November 04, 2019, 11:35:52 am »
Hello All,

If I receive a .obj file with a .mtl file how can I convert the ambient and diffuse color settings listed in the file (Ka & Kd) into an equivalent color in Keyshot? Ka & Kd are listed as 0 - 1 in the file whereas Keyshot (at least in RGB) is listed as 0-255 values...

Thank you!

Perry (Furniture_Guy)

Offline Eugen Fetsch

  • Sr. Member
  • ****
  • Posts: 308
    • www.camomiles.de
Re: MTL File Interpretation
« Reply #1 on: November 04, 2019, 11:25:41 pm »
https://www.easyrgb.com/en/convert.php#inputFORM

Use HEX in the RGB option to save time.
« Last Edit: November 04, 2019, 11:27:55 pm by Eugen Fetsch »

Offline Furniture_Guy

  • Full Member
  • ***
  • Posts: 132
    • Virco Educational Furniture
Re: MTL File Interpretation
« Reply #2 on: November 05, 2019, 08:41:10 am »
Thank you! That will come in VERY handy.

I wish there was some video or article from Luxion that would allow you to interpret all the variables in a .mtl file:

newmtl ealu_fabric       (Yes, material name)
   Ns 50.000000
   Ni 1.000000
   d 0.850000
   Tr 0.150000
   Tf 0.850000 0.850000 0.850000
   illum 2
   Ka 0.588000 0.588000 0.588000
   Kd 0.039216 0.039216 0.039216
   Ks 0.000000 0.000000 0.000000
   Ke 0.000000 0.000000 0.000000
   map_d -s 36.000000 28.000000 1.000000 squares.gif      (Yes, image)

to the equivalent values in a Keyshot material. I don't mind doing the work, it's just that right now I'm shooting in the dark! Wikipedia has a page on 'Wavefront .obj file' but how to take the values above and plug them into Keyshot?

Yes, I'm a dreamer like those AMD video card support people...

Perry (Furniture_Guy)

Offline Eugen Fetsch

  • Sr. Member
  • ****
  • Posts: 308
    • www.camomiles.de
Re: MTL File Interpretation
« Reply #3 on: November 05, 2019, 08:48:41 am »
 :o pretty tech topic.
Did you try to ask Luxion support for help?

Offline Furniture_Guy

  • Full Member
  • ***
  • Posts: 132
    • Virco Educational Furniture
Re: MTL File Interpretation
« Reply #4 on: November 05, 2019, 08:53:26 am »
No, I just assumed that would be futile. I also think there would be legal/copyright issues even though the .obj file format is an open one...

Thank you again for the link to the Convert RGB page.

Perry (Furniture_Guy)


Offline Søren

  • Developer
  • Jr. Member
  • *****
  • Posts: 88
  • KeyShot Developer
    • KeyShot
Re: MTL File Interpretation
« Reply #5 on: November 07, 2019, 11:08:36 am »
The shading model used in the original Wavefront Obj is the Phong shading model which is not used anywhere in KeyShot - we use more modern models. Therefore there will never be a match if you want to translate into KeyShot materials. Some of the properties in the mtl-files have no meaningful translation to KeyShot materials.

The following is a general guideline that is by no means accurate.
In general you will probably want to use the Advanced material or Plastic (Transparent) and do the following conversions:

Ns: is a measure of glossiness - the higher the value the lower roughness you should use.

The colors should be mapped from [0, 1] to [0, 255] in KeyShot with the sRGB profile in the link Eugen posted. I agree it would be nice with [0, 1] color input in KeyShot. I cannot see anything about gamma in the obj-description but you probably want to enter the conversion with "Use gamma corrected values for input" (which is on by default).

Ka should be mapped to the Ambient color on the Advanced material
Ks should be mapped to the Specular color
Kd should be mapped to the diffuse color
You could try mapping Tr to the specular transmission color - maybe that will work. Alternatively you need to use a uniformly colored opacity map with that color (e.g. use a color adjust node as input to opacity to get a uniformly colored texture).
I am not sure about the relationship between Tr and d - typically you have Tr + d = 1 as in you case so d is the 'color inverted' value of Tr.

Any item saying map_(something), that (something) refers to a UV mapped texture on the corresponding texture channel (map_Ka is an ambient color map, map_d is an inverted opacity map)

Hope this helps,
Søren