[Bf-extensions-cvs] [5a528cae] blender-v2.81-release: Fix T70879: FBX importer wrong normal map strength.

Bastien Montagne noreply at git.blender.org
Tue Nov 5 17:22:41 CET 2019


Commit: 5a528cae96da99b1e072e2a59478b4febcf5591c
Author: Bastien Montagne
Date:   Tue Nov 5 17:21:06 2019 +0100
Branches: blender-v2.81-release
https://developer.blender.org/rBA5a528cae96da99b1e072e2a59478b4febcf5591c

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

===================================================================

M	io_scene_fbx/__init__.py
M	io_scene_fbx/export_fbx_bin.py
M	io_scene_fbx/import_fbx.py

===================================================================

diff --git a/io_scene_fbx/__init__.py b/io_scene_fbx/__init__.py
index 5211b845..a381d83b 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 970fc721..1c43180d 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 93b01b9f..751a2b17 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



More information about the Bf-extensions-cvs mailing list