Hey guys,
I’m hoping one of the D|S developer/tech guys can answer a few questions related to the .mtl files being output when exporting .obj files.
First off, there seems to be several ‘issues’ with the format/specification interpretation - I’ll refrain from flat-out calling them bugs (in most cases), but they certainly seem “at odds” with the specification (I’ve seen a few around the web, but will reference this one as seemingly fairly ‘official’: http://www.fileformat.info/format/material/ ).
With the above in mind, it’s also understood that in many cases, a relatively ancient (in computer terms) file format is being (re)interpreted for modern-day use.
1. (partial) paths in texture file names.
I’m not sure if it’s hard-coded or just circumstantial, but I typically see “/Maps/” tacked on to the front of the file name…
map_Kd /Maps/kd_filename.jpg
...the linked spec may not specifically state that there should be no path, but none of the examples have any path and having (modern) path info (which could include spaces) would certainly complicate things and therefore any/all path info should be left out. The individual 3D application will have it’s own mechanism for specifying texture search paths (current folder, listed preferences folders, etc).
2. map_Bump
While I’ve seen other apps (mistakenly) use this keyword, it does not exist in the spec. The proper keyword is simply “bump”.
3. map_D
Note that the proper ‘case’ of this keyword is: map_d ...this might seem like a nit-pick, but just as you shouldn’t use “NewMaterial” or “NEWMATERIAL” or “MAP_KD”, you should use the proper case for “map_d”.
4. Dissolve/Transparency value - “d 1”
This is just a suggestion, but the .mtl file format is a ‘sparse’ format. In other words, records/values can be missing if not needed and a Dissolve value of 1.0 (no transparency) is a fairly well accepted/understood ‘default’ value… if the material has no transparency and/or no map_d value, I’d recommend leaving it out.
5. Ni 0
From the linked spec:
“[Ni] Specifies the optical density for the surface. This is also known as index of refraction.
“optical_density” is the value for the optical density. The values can range from 0.001 to 10. A value of 1.0 means that light does not bend as it passes through an object. Increasing the optical_density increases the amount of bending. Glass has an index of refraction of about 1.5. Values of less than 1.0 produce bizarre results and are not recommended. “
...D|S is writing “Ni 0” in many/all (?) cases, which is a) not needed at all if there is no Dissolve (transparency) value and b) is probably way too low of a value when/if it should be used.
6. Ka (ambient) values
This is one value where there seems to be some general confusion/interpretation differences… Poser (and I believe D|S) basically/effectively use Ambient for a material to produce it’s own light/color. My plugin for Cinema 4D uses a similar interpretation and maps this to the “Luminance” value, however other applications use a different interpretation and often write 1.0 values for this. I like/agree with the idea that D|S is (now) writing 0.0 values, but I’d recommend leaving it (the Ka record) out entirely unless you specifically need the material to produce it’s own light/color.
7. Km
Wassat?
. This is obviously an invented record/keyword (I’ve never seen it listed in any spec or files from any other app before)... my plugin ignores it, but I’m just curious what it’s used for.
NOTE: All of the above are meant as constructive suggestions, based solely on my own personal opinions and experience with .obj/.mtl file coding over the past dozen or so years - no offense intended.
Cheers,
Keith


