I have a monkey had with a simple material: enter image description here enter image description here

I want to export this to a .obj-file. But it looks like this (opened in g3dviewer): enter image description here

Is there a way to lighten up the .obj-file?

Any help?


2 Answers 2


As far as I know .obj files can't include lights, so you are left with manipulating the material. UV textures are supported though, so you could e.g. bake ambient occlusion or full lighting into a texture.



I think the problem here is that the light setup in Blender differs from the light setup in g3dviewer.

If you view your mesh in Solid display mode, Blender uses three directional (sun) lamps to illuminate the objects. You can find the settings of these lamps in the system tab of the user preferences:

enter image description here

The direction of these lamps is relative to your current view, so if you rotate your view around in the scene the lamps will rotate with you. This ensures a good illumination of all objects.

If you are in g3dviewer you have to replicate the light setup to get the same results.

If you are still in doubt about the exportet material have a look at the .mtl file that is written with the .obj. It contains the materials of the meshes.

Take this simple red material for example:

enter image description here

In the .mtl file it looks like this:

newmtl Material
Ns 96.078431
Ka 0.000000 0.000000 0.000000
Kd 0.640000 0.000000 0.000000
Ks 0.500000 0.500000 0.500000
Ni 1.000000
d 1.000000
illum 2

The line starting with Ns contains the specular exponent of the material. In Blender the range of the specular exponent (called Hardness here) is 0 to 511, while in .mtl the range is 0 to 1000. Exept for a rounding error '96/1000' is equal to '50/511'. This is how the specular exponent gets translated.

The next line Ka contains the ambient color. Blender does not have per-object ambient color. You can find the ambient color for all objects in the world settings. It is set to black by default, thus the red, green and blue component of the ambient color are zero.

The third line gets more interesting: Kd describes the diffuse color. But while in Blender you can set the color value and the intensity separately, they are multiplied in the .mtl file. If you have a look at the screenshot, the red value of the color and the intensity value both are 0.8. Thus the red value in the .mtl file is 0.8*0.8 = 0.64. Green and blue are 0 in blender, so they are also zero in the .mtl file.

Next is the specular color Ks. It works similarly to the diffuse color. The specular color in blender is white (1.0 in all channels) and the specular intensity in Blender is 0.5, so the resulting color in the .mtl file is 0.5 for red, green and blue.

The value Ni is the so-called 'Index of refraction' (IOR). It is set in the transparency settings of the Blender material and describes how strongly light is bent when it passes through the boundary between transparent materials (i.e. air and glass). Since I have not touched the transparency it contains the default value of 1.0.

d is short for dissolve. This value is called Alpha in Blender and represents the opacity of the object. A value of 1.0 means that the object is completely opaque, a value of 0.0 would mean that it is completely transparent.

The number after illum encodes the illumination model used for the current material. You can find a list of all illumination models and their corresponding numbers in the link at the end of my answer.

With this information you should be able to verify if Blender exports your materials correctly.

You can find a complete description of the .mtl format here.

  • $\begingroup$ So there isn't really such a thing called specular intensity in .mtl files? If my specular intensity is a, I will just multiply a with my specular color [1, 1, 1] to get [a, a, a]. $\endgroup$ Commented Dec 25, 2016 at 15:21
  • 1
    $\begingroup$ @SibbsGambling Yes, for the Ks setting this is how it works. Note that you can also define the specularity using Ks spectral <file.rfl> <factor>, where <file.rfl> is a file containing the spectral curve of the reflectivity and <factor> is a scaling factor for the reflectivity, similar to specular intensity in blender. I have not found a documentation for the .rfl format, so I do not know what it looks like. $\endgroup$
    – maddin45
    Commented Dec 28, 2016 at 11:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .