Page MenuHome

Documentation: explain that Blender 2.80 Exporting a textured OBJ with any shader other than Principled BSDF will result in an MTL without map_Kd pointing to texture file
Closed, ResolvedPublic

Description

System Information
Operating system: Windows 10
Graphics card: NVIDIA GeForce GTX 950M

Blender Version
Broken: 2.80

Short description of error
When exporting an OBJ of a mesh with a material using an image texture, the MTL file only includes the necessary map_Kd line at the end when using the "Principled BSDF" shader.

If you export an OBJ using another shader, such as "Diffuse BSDF," or no special shader (connecting the "color" of the texture node directly to the "surface" of the output node, when you export an OBJ, the MTL file has no map_Kd line, and the texture is not visible in other applications. You can manually add the map_Kd line, and the model works fine, with the proper texture. But this workaround is not ideal.

Exact steps for others to reproduce the error
If you download the attached blend file, which includes a mesh with a material using an image texture, and export the OBJ, you will reproduce the error. If you go into the "shading" interface and add a "Principled BDSF" shader between the texture and output node, then when you export the OBJ, the MTL will have the map_Kd line and will work properly.

Event Timeline

Stephen Swaney (stiv) lowered the priority of this task from Needs Triage by Developer to Needs Information from User.Aug 15 2019, 7:05 PM

Don't forget to attach the attached .blend!

Weird, I uploaded it, but it wasn't in the post. It should be there now, though.

Stephen Swaney (stiv) raised the priority of this task from Needs Information from User to Needs Triage by Developer.Aug 15 2019, 8:18 PM

This report is accurate. For the .mtl creation the exporter use mat_wrap = node_shader_utils.PrincipledBSDFWrapper(mat) if mat else None and maps the socket inputs to the map types. Could be a design choice (?), but it's not documented in the manual.

Philipp Oeser (lichtwerk) lowered the priority of this task from Needs Triage by Developer to Normal.

This is a design choice, yes.

It is documented in code

Hard coded shader setup, based in Principled BSDF.
Should cover most common cases on import, and gives a basic nodal shaders support for export.
Supports basic: diffuse/spec/reflect/transparency/normal, with texturing.

So this is not a bug from a code-point-of-view, but I will confirm this as being an issue with the documentation, it should be documented in the manual as well (as there are other limitations also, see T68399)

@Bastien Montagne (mont29): do you want to do that (change the manual)?
@Aaron Carlisle (Blendify): I think it makes sense if I could get a member of the documentation team as well (and get commit rights), I could do this then, too...?

Philipp Oeser (lichtwerk) renamed this task from Blender 2.80 Exporting a textured OBJ with any shader other than Principled BSDF results in an MTL without map_Kd pointing to texture file to Documentation: explain that Blender 2.80 Exporting a textured OBJ with any shader other than Principled BSDF will result in an MTL without map_Kd pointing to texture file.Aug 16 2019, 9:53 AM

If it is a(n undocumented) design choice, it is different from the design choice in 2.7 versions of Blender, which exported a usable .mtl . It also feels like an ill-advised design choice as it depends on a workaround outside of the program itself (manually adding the map_Kt line to the mtl in a text editor) to "remedy."

If the issue is just going to be band-aided by updating the documentation/manual, it would be helpful for users, especially the new users attracted by 2.8's more student/amateur-friendly interface, if that documentation includes information on how to export a proper MTL (or, if that's not possible in any way through Blender now, how to jerry-rig their MTL in a text editor to work properly).

It is plainly impossible to export any kind of node-based shading system into a fixed-pipeline thing like MTL or FBX formats suport. That’s just basic common sense. We can only offer some very limited approximation in some well-defined cases. Note that 2.7x did not export node-based materials at all.

It's strange that Blender 2.8 solved most interface annoyances when compared with other 3D packages but keep some that are still unique. I've tested most 3D packages and Blender is the only one that is unable to save a .obj file with image textures (even if this option is available in the export as "Export Materials". If we are using an image file we must add manually a mat_kd line with the proper image name after. Come on guys, this is not, by any means. a design choice, it's just clumsy and unique to blender. If I choose in the options to export materials and "copy" option available, the used textures should be copied and the respective mat_kd line added.

Took me days of pulling hair and googling to find that textures not exporting is by design. I don't think it's an unreasonable user expectation for simple shaders like Diffuse BDSF to export texture images. I can live with the workaround however. It's just extremely obscure and unintuitive.

Instead of burying it in the manual somewhere, why not indicate the limitation in the application UI. For example, "some materials in your export don't support the export of textures". Just a suggestion to help the next poor slob who has the same problem. I'm happy I have a solution finally.

As Ryan said, it's tolerable that complex textures with layers are not exported. However, image textures should be exported correctly, as in any other 3D package.