OBJ/MTL Material Roughness imported and exported inaccurately. #94516

Closed
opened 2021-12-30 23:01:26 +01:00 by Christian Coppoletti · 7 comments

System Information
Operating system: Windows-10-10.0.19041-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 2060 SUPER/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 497.09

Blender Version
Broken: version: 2.93.0, branch: master, commit date: 2021-06-02 11:21, hash: blender/blender@84da05a8b8
Worked: (newest version of Blender that worked as expected)

Short description of error
Material Roughness range is off in the blender .obj exporter and importer.
Currently it is based on a 0-900 smoothness scale ("Ns" in the .mtl) when it should be based on a 0-1000 range according to this website about the format:
http://www.paulbourke.net/dataformats/mtl/

The problem is that other programs are using a 0-1000 scale for the import and every time you exchange between the programs it slowly gets more and more rough.

It's easy to fix, I've done it myself just by changing a couple lines in the import/export python scripts.
We could make this part of a bigger change integrating the PBR mtl tags outlined here:
http://exocortex.com/blog/extending_wavefront_mtl_to_support_pbr

Exact steps for others to reproduce the error

  1. Set Roughness to 0 on BSDF material
  2. Export to OBJ format
  3. Open up the accompanying .mtl file.
  4. Look at the Ns value for the material and observe that it maxes out at 900

RoughnessBug.blend
RoughnessBug.obj
RoughnessBug.mtl

**System Information** Operating system: Windows-10-10.0.19041-SP0 64 Bits Graphics card: NVIDIA GeForce RTX 2060 SUPER/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 497.09 **Blender Version** Broken: version: 2.93.0, branch: master, commit date: 2021-06-02 11:21, hash: `blender/blender@84da05a8b8` Worked: (newest version of Blender that worked as expected) **Short description of error** Material Roughness range is off in the blender .obj exporter and importer. Currently it is based on a 0-900 smoothness scale ("Ns" in the .mtl) when it should be based on a 0-1000 range according to this website about the format: http://www.paulbourke.net/dataformats/mtl/ The problem is that other programs are using a 0-1000 scale for the import and every time you exchange between the programs it slowly gets more and more rough. It's easy to fix, I've done it myself just by changing a couple lines in the import/export python scripts. We could make this part of a bigger change integrating the PBR mtl tags outlined here: http://exocortex.com/blog/extending_wavefront_mtl_to_support_pbr **Exact steps for others to reproduce the error** 1. Set Roughness to 0 on BSDF material 2. Export to OBJ format 3. Open up the accompanying .mtl file. 4. Look at the Ns value for the material and observe that it maxes out at 900 [RoughnessBug.blend](https://archive.blender.org/developer/F12782417/RoughnessBug.blend) [RoughnessBug.obj](https://archive.blender.org/developer/F12782418/RoughnessBug.obj) [RoughnessBug.mtl](https://archive.blender.org/developer/F12782419/RoughnessBug.mtl)

Added subscriber: @Christian-Coppoletti

Added subscriber: @Christian-Coppoletti
Member

Added subscribers: @mont29, @PratikPB2123

Added subscribers: @mont29, @PratikPB2123
Member

Changed status from 'Needs Triage' to: 'Needs Developer To Reproduce'

Changed status from 'Needs Triage' to: 'Needs Developer To Reproduce'
Member

Hi, thanks for the report. I see, range 0-900 is said in the code: https://developer.blender.org/diffusion/BA/browse/master/io_scene_obj/export_obj.py$77

Hi @mont29 , can you look at this issue? On website (s) they have given Specular exponent range from 0 to 1000.

Hi, thanks for the report. I see, range 0-900 is said in the code: https://developer.blender.org/diffusion/BA/browse/master/io_scene_obj/export_obj.py$77 Hi @mont29 , can you look at this issue? On [website ](https://en.wikipedia.org/wiki/Wavefront_.obj_file)(s) they have given Specular exponent range from 0 to 1000.

Indeed... Will commit fix for this, note that it will slightly 'break' compatibility with existing files exported from Blender though, since the new imported value from them will be slightly different.

Indeed... Will commit fix for this, note that it will slightly 'break' compatibility with existing files exported from Blender though, since the new imported value from them will be slightly different.

This issue was referenced by f26299bacc

This issue was referenced by f26299bacc19ef64ab8e11296694756d77e83449

Changed status from 'Needs Developer To Reproduce' to: 'Resolved'

Changed status from 'Needs Developer To Reproduce' to: 'Resolved'
Bastien Montagne self-assigned this 2022-01-10 11:24:00 +01:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
4 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#94516
No description provided.