From 5a528cae96da99b1e072e2a59478b4febcf5591c Mon Sep 17 00:00:00 2001 From: Bastien Montagne <b.mont29@gmail.com> Date: Tue, 5 Nov 2019 17:21:06 +0100 Subject: [PATCH] Fix T70879: FBX importer wrong normal map strength. that value was not exported, and imported with some weird conversion without any proper explanation for it. For now, just export and import the value as-is, we can always come back and tweak it once we know what BumpFactor is supposed to be exactly in FBX... --- io_scene_fbx/__init__.py | 2 +- io_scene_fbx/export_fbx_bin.py | 2 +- io_scene_fbx/import_fbx.py | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/io_scene_fbx/__init__.py b/io_scene_fbx/__init__.py index 5211b8459..a381d83b9 100644 --- a/io_scene_fbx/__init__.py +++ b/io_scene_fbx/__init__.py @@ -21,7 +21,7 @@ bl_info = { "name": "FBX format", "author": "Campbell Barton, Bastien Montagne, Jens Restemeier", - "version": (4, 20, 1), + "version": (4, 20, 2), "blender": (2, 81, 6), "location": "File > Import-Export", "description": "FBX IO meshes, UV's, vertex colors, materials, textures, cameras, lamps and actions", diff --git a/io_scene_fbx/export_fbx_bin.py b/io_scene_fbx/export_fbx_bin.py index 970fc7219..1c43180db 100644 --- a/io_scene_fbx/export_fbx_bin.py +++ b/io_scene_fbx/export_fbx_bin.py @@ -1328,10 +1328,10 @@ def fbx_data_material_elements(root, ma, scene_data): elem_props_template_set(tmpl, props, "p_number", b"TransparencyFactor", 1.0 - ma_wrap.alpha) elem_props_template_set(tmpl, props, "p_number", b"Opacity", ma_wrap.alpha) elem_props_template_set(tmpl, props, "p_vector_3d", b"NormalMap", (0.0, 0.0, 0.0)) + elem_props_template_set(tmpl, props, "p_double", b"BumpFactor", ma_wrap.normalmap_strength) # Not sure about those... """ b"Bump": ((0.0, 0.0, 0.0), "p_vector_3d"), - b"BumpFactor": (1.0, "p_double"), b"DisplacementColor": ((0.0, 0.0, 0.0), "p_color_rgb"), b"DisplacementFactor": (0.0, "p_double"), """ diff --git a/io_scene_fbx/import_fbx.py b/io_scene_fbx/import_fbx.py index 93b01b9f2..751a2b177 100644 --- a/io_scene_fbx/import_fbx.py +++ b/io_scene_fbx/import_fbx.py @@ -1425,8 +1425,7 @@ def blen_read_material(fbx_tmpl, fbx_obj, settings): ma_wrap.metallic = elem_props_get_number(fbx_props, b'ReflectionFactor', 0.0) # We have no metallic (a.k.a. reflection) color... # elem_props_get_color_rgb(fbx_props, b'ReflectionColor', const_color_white) - # (x / 7.142) is only a guess, cycles usable range is (0.0 -> 0.5) - ma_wrap.normalmap_strength = elem_props_get_number(fbx_props, b'BumpFactor', 2.5) / 7.142 + ma_wrap.normalmap_strength = elem_props_get_number(fbx_props, b'BumpFactor', 1.0) # For emission color we can take into account the factor, but only for default values, not in case of texture. emission_factor = elem_props_get_number(fbx_props, b'EmissiveFactor', 1.0) ma_wrap.emission_color = [c * emission_factor -- GitLab