diff options
author | Bastien Montagne <bastien@blender.org> | 2022-01-10 13:20:59 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2022-01-10 13:20:59 +0300 |
commit | f26299bacc19ef64ab8e11296694756d77e83449 (patch) | |
tree | 54f349d104b553c719921e5efbb0da323030e207 /io_scene_obj/import_obj.py | |
parent | 29c03b657082c266233b3795407d71629f3a02ea (diff) |
Fix T94516: OBJ/MTL Material Roughness imported and exported inaccurately.
The addon would assume an OBJ range of [0.0-900.0] for the Ns value,
when it actually is supposed to be [0.0-1000.0].
WARNING: This is introducing a slight incompatibility (value shifting of
the roughness parameter) with older OBJ files exported by Blender.
Diffstat (limited to 'io_scene_obj/import_obj.py')
-rw-r--r-- | io_scene_obj/import_obj.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/io_scene_obj/import_obj.py b/io_scene_obj/import_obj.py index 87ba4bd2..0ba4f898 100644 --- a/io_scene_obj/import_obj.py +++ b/io_scene_obj/import_obj.py @@ -361,9 +361,9 @@ def create_materials(filepath, relpath, context_mat_wrap.emission_strength = 1.0 elif line_id == b'ns': # XXX Totally empirical conversion, trying to adapt it - # (from 0.0 - 900.0 OBJ specular exponent range to 1.0 - 0.0 Principled BSDF range)... - val = max(0.0, min(900.0, float_func(line_split[1]))) - context_mat_wrap.roughness = 1.0 - (sqrt(val) / 30) + # (from 0.0 - 1000.0 OBJ specular exponent range to 1.0 - 0.0 Principled BSDF range)... + val = max(0.0, min(1000.0, float_func(line_split[1]))) + context_mat_wrap.roughness = 1.0 - (sqrt(val / 1000)) context_material_vars.add("roughness") elif line_id == b'ni': # Refraction index (between 0.001 and 10). context_mat_wrap.ior = float_func(line_split[1]) |