# Export custom mtl file

So far I've made a few models in blender. When I exported my textured model before, the mtl file always looked like this:

newmtl None
Ns 0
Ka 0.000000 0.000000 0.000000
Kd 0.8 0.8 0.8
Ks 0.8 0.8 0.8
d 1
illum 2
map_Kd F:\images\leather.bmp


But when I export a mtl file now it looks like:

newmtl Material
Ns 96.078431
Ka 0.000000 0.000000 0.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ni 1.000000
d 1.000000
illum 2
map_Kd F:\images\dice0.bmp


As you can see, Ni parameter appears in my second example. Because I've written a custom obj file loader in C++, I only need 7 parameters and not 8.

Is there a way to solve this easily?

• Ni (optical_density) - doesn't get added by default, do you have glass materials or something with an IOR? – zeffii May 28 '15 at 20:12
• I wasted to make a dice.So the only operations that i used were:bevel,and smart UV unwrapp. – Robert Puscasu May 28 '15 at 20:20

Ni (optical_density)

The code lives in scripts/addons/io_scene_obj/export.obj (line 92+ ). You could comment out these lines:

if hasattr(mat, "raytrace_transparency") and hasattr(mat.raytrace_transparency, "ior"):
fw('Ni %.6f\n' % mat.raytrace_transparency.ior)  # Refraction index
else:
fw('Ni %.6f\n' % 1.0)


The .obj exporter will automatically add the Ni as soon as you assign any material to the object.

Could be worth updating your C++ obj file loader, at least to ignore the Ni command if material is set, because it is a valid part of the .mtl specs