diff --git a/io_scene_obj/__init__.py b/io_scene_obj/__init__.py index 400016894ec8ed663d749c7078431b16ce03636c..78c2314e4d02780f8c430fb0a36a092cb2820b73 100644 --- a/io_scene_obj/__init__.py +++ b/io_scene_obj/__init__.py @@ -21,8 +21,8 @@ bl_info = { "name": "Wavefront OBJ format", "author": "Campbell Barton, Bastien Montagne", - "version": (3, 8, 1), - "blender": (2, 81, 6), + "version": (3, 9, 0), + "blender": (3, 0, 0), "location": "File > Import-Export", "description": "Import-Export OBJ, Import OBJ mesh, UV's, materials and textures", "warning": "", diff --git a/io_scene_obj/export_obj.py b/io_scene_obj/export_obj.py index 796515cd28fb64bb7555cf98fbf2e7ebce50b8a8..e5466c764d3006d8062187a986ca6645bdd0324c 100644 --- a/io_scene_obj/export_obj.py +++ b/io_scene_obj/export_obj.py @@ -74,9 +74,10 @@ def write_mtl(scene, filepath, path_mode, copy_set, mtl_dict): use_transparency = mat_wrap.alpha != 1.0 # XXX Totally empirical conversion, trying to adapt it - # (from 1.0 - 0.0 Principled BSDF range to 0.0 - 900.0 OBJ specular exponent range)... - spec = (1.0 - mat_wrap.roughness) * 30 - spec *= spec + # (from 1.0 - 0.0 Principled BSDF range to 0.0 - 1000.0 OBJ specular exponent range): + # (1.0 - bsdf_roughness)^2 * 1000 + spec = (1.0 - mat_wrap.roughness) + spec *= spec * 1000 fw('Ns %.6f\n' % spec) # Ambient diff --git a/io_scene_obj/import_obj.py b/io_scene_obj/import_obj.py index 87ba4bd2afff02a3d0be408fe41212296c7b19c1..0ba4f89853d84f4c3766d9a5223583e2fbaee3c2 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])