# Exported .mtl does not specify the texture image

When I export the .obj file, the generated .mtl does not specify the texture image used by the model.

I expected it to have

map_Kd texture.png


but it does not have it. If I write map_Kd texture.png manually, it works fine.

How can I automate to include the texture image when exporting from blender?

• Displacement socket on Material Output is now a Vector field and should typically never be connected without a 'Displacement' node (Displacement or Vector Displacement). I don't know whether MTL supports such displacement connections. Jun 17 '20 at 11:30
• This has already been answered here, including a link to the relevant manual page. Jun 23 '20 at 13:22

The textures color output should be attached to the color input of the shader (Diffuse BSDF in your example), for it to be exported into the mtl file.

Edit: It seems the PrincipleBSDF shader node (instead of DiffuseBSDF) is needed for the .obj / .mtl export to function properly!

• According to the Wavefront mtl specification map_Kd is the diffuse texture. So the texture that you want to be exported as map_Kd should be set as an input to the diffuse color. Jun 17 '20 at 10:36
• I cant do this. Im using the model in 'babylonjs' and I need the ability to change the color of the texture programmatically by changing diffuse color = x then the texture color will change. If I assign the texture image as color, when I change the color programmatically, the texture will be gone. Jun 17 '20 at 16:18
• Agree with Simon, this would result in map_Kd texture.png (what you are asking for in your question). Sounds like an issue with 'babylonjs' rather. Can you elaborate on that? @AlvinStefanus Jun 18 '20 at 10:00
• There is no problem with babylon.js at all. The exported .mtl is the problem. I have found a way to fix it by connecting the image texture into both displacement and pricipled BSDF (which will produce the correct mtl file). The base color of Principled BSDF is changed within the babylon.js and produce what I want. The texture is shown and also the flexibility to change the base color of the texture. Jun 21 '20 at 9:25
• Glad you found a solution! Jun 23 '20 at 11:07

I solve the problem with this schema

• How this is different to Simon's answer one week ago? Jun 21 '20 at 23:51