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 #68704

Closed
opened 2019-08-15 18:57:49 +02:00 by Luke Meeken · 20 comments

{F7666260}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.

{[F7666260](https://archive.blender.org/developer/F7666260/baking_test.zip)}**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.
Author

Added subscriber: @lmeeken

Added subscriber: @lmeeken

Added subscriber: @StephenSwaney

Added subscriber: @StephenSwaney

Don't forget to attach the attached .blend!

Don't forget to attach the attached .blend!
Author

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

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

Added subscriber: @rjg

Added subscriber: @rjg

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.

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](https://docs.blender.org/manual/en/latest/addons/io_scene_obj.html).
Member

Added subscribers: @Blendify, @mont29, @lichtwerk

Added subscribers: @Blendify, @mont29, @lichtwerk
Bastien Montagne was assigned by Philipp Oeser 2019-08-16 09:52:09 +02:00
Member

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 #68399)

@mont29: do you want to do that (change the manual)?
@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...?

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 #68399) @mont29: do you want to do that (change the manual)? @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 changed title 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 2019-08-16 09:53:21 +02:00

This issue was referenced by blender/documentation@5715

This issue was referenced by blender/documentation@5715

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Author

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).

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 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**.
Member

@lichtwerk you now have commit rights.

@lichtwerk you now have commit rights.

Added subscriber: @Spartacus1

Added subscriber: @Spartacus1

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.

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.

Added subscriber: @ryanackley

Added subscriber: @ryanackley

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.

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.

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.

Added subscriber: @CameronA

Added subscriber: @CameronA

I wanted to offer a different perspective into why this should be addressed and usable .mtl files should be exported.
I'm using blender in my full colour 3D printing workflow. Because there's no repository of printable colour models, i'm having to transform animation assets into printable files.
In this context i want to have a baked on version of the texture/material and having to manually edit the .mtl seems silly given the power and versatility of blender.
Can we change this from resolved and just add the export of map_Kd "file name" to the .mtl please?

I wanted to offer a different perspective into why this should be addressed and usable .mtl files should be exported. I'm using blender in my full colour 3D printing workflow. Because there's no repository of printable colour models, i'm having to transform animation assets into printable files. In this context i want to have a baked on version of the texture/material and having to manually edit the .mtl seems silly given the power and versatility of blender. Can we change this from resolved and just add the export of map_Kd "file name" to the .mtl please?
Sign in to join this conversation.
No Milestone
No project
No Assignees
10 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#68704
No description provided.