Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2020-09-17 16:26:52 +0300
committerBrecht Van Lommel <brecht@blender.org>2020-09-17 19:55:15 +0300
commitec4ad081e564781230e3a9b31ef48f1f8fb71899 (patch)
tree5468926df074e0475c8530db97e60be47825ae54 /io_scene_fbx
parent051770b36de923a34a023ccd598dd315d2428f3a (diff)
Shaders: update OBJ and FBX for for Principled BSDF emission strength
Diffstat (limited to 'io_scene_fbx')
-rw-r--r--io_scene_fbx/export_fbx_bin.py4
-rw-r--r--io_scene_fbx/import_fbx.py10
2 files changed, 8 insertions, 6 deletions
diff --git a/io_scene_fbx/export_fbx_bin.py b/io_scene_fbx/export_fbx_bin.py
index 1c43180d..65a5b8f1 100644
--- a/io_scene_fbx/export_fbx_bin.py
+++ b/io_scene_fbx/export_fbx_bin.py
@@ -1309,7 +1309,7 @@ def fbx_data_material_elements(root, ma, scene_data):
elem_props_template_set(tmpl, props, "p_number", b"DiffuseFactor", 1.0)
# Principled BSDF only has an emissive color, so we assume factor to be always 1.0.
elem_props_template_set(tmpl, props, "p_color", b"EmissiveColor", ma_wrap.emission_color)
- elem_props_template_set(tmpl, props, "p_number", b"EmissiveFactor", 1.0)
+ elem_props_template_set(tmpl, props, "p_number", b"EmissiveFactor", ma_wrap.emission_strength)
# Not in Principled BSDF, so assuming always 0
elem_props_template_set(tmpl, props, "p_color", b"AmbientColor", ambient_color)
elem_props_template_set(tmpl, props, "p_number", b"AmbientFactor", 0.0)
@@ -1808,7 +1808,7 @@ PRINCIPLED_TEXTURE_SOCKETS_TO_FBX = (
("base_color_texture", b"DiffuseColor"),
("alpha_texture", b"TransparencyFactor"), # Will be inverted in fact, not much we can do really...
# ("base_color_texture", b"TransparentColor"), # Uses diffuse color in Blender!
- # ("emit", "emit", b"EmissiveFactor"),
+ ("emission_strength_texture", b"EmissiveFactor"),
("emission_color_texture", b"EmissiveColor"),
# ("ambient", "ambient", b"AmbientFactor"),
# ("", "", b"AmbientColor"), # World stuff in Blender, for now ignore...
diff --git a/io_scene_fbx/import_fbx.py b/io_scene_fbx/import_fbx.py
index 3e0b2bfd..319c4972 100644
--- a/io_scene_fbx/import_fbx.py
+++ b/io_scene_fbx/import_fbx.py
@@ -1457,10 +1457,9 @@ def blen_read_material(fbx_tmpl, fbx_obj, settings):
# We have no metallic (a.k.a. reflection) color...
# elem_props_get_color_rgb(fbx_props, b'ReflectionColor', const_color_white)
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
- for c in elem_props_get_color_rgb(fbx_props, b'EmissiveColor', const_color_black)]
+ # Emission strength and color
+ ma_wrap.emission_strength = elem_props_get_number(fbx_props, b'EmissiveFactor', 1.0)
+ ma_wrap.emission_color = elem_props_get_color_rgb(fbx_props, b'EmissiveColor', const_color_black)
nodal_material_wrap_map[ma] = ma_wrap
@@ -3151,6 +3150,9 @@ def load(operator, context, filepath="",
elif lnk_type in {b'EmissiveColor'}:
ma_wrap.emission_color_texture.image = image
texture_mapping_set(fbx_lnk, ma_wrap.emission_color_texture)
+ elif lnk_type in {b'EmissiveFactor'}:
+ ma_wrap.emission_strength_texture.image = image
+ texture_mapping_set(fbx_lnk, ma_wrap.emission_strength_texture)
else:
print("WARNING: material link %r ignored" % lnk_type)