[Bf-blender-cvs] [bc2a8f01ba9] soc-2020-io-performance: Material: add emission strength's effect on Ke (color)

Ankit Meel noreply at git.blender.org
Mon Sep 21 13:35:41 CEST 2020


Commit: bc2a8f01ba91e1ef2c52541be1f46d846a56a8df
Author: Ankit Meel
Date:   Mon Sep 21 14:00:14 2020 +0530
Branches: soc-2020-io-performance
https://developer.blender.org/rBbc2a8f01ba91e1ef2c52541be1f46d846a56a8df

Material: add emission strength's effect on Ke (color)

Ref {rBAec4ad081e564}

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

M	source/blender/io/wavefront_obj/intern/obj_export_mtl.cc

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

diff --git a/source/blender/io/wavefront_obj/intern/obj_export_mtl.cc b/source/blender/io/wavefront_obj/intern/obj_export_mtl.cc
index af9cff8860d..90879a61809 100644
--- a/source/blender/io/wavefront_obj/intern/obj_export_mtl.cc
+++ b/source/blender/io/wavefront_obj/intern/obj_export_mtl.cc
@@ -206,7 +206,10 @@ void MaterialWrap::store_bsdf_properties(MTLMaterial &r_mtl_mat) const
   float3 diffuse_col = {export_mtl_->r, export_mtl_->g, export_mtl_->b};
   copy_property_from_node(SOCK_RGBA, bsdf_node_, "Base Color", {diffuse_col, 3});
   float3 emission_col{0.0f};
+  float emission_strength = 0.0f;
+  copy_property_from_node(SOCK_FLOAT, bsdf_node_, "Emission Strength", {&emission_strength, 1});
   copy_property_from_node(SOCK_RGBA, bsdf_node_, "Emission", {emission_col, 3});
+  mul_v3_fl(emission_col, emission_strength);
 
   /* See https://wikipedia.org/wiki/Wavefront_.obj_file for all possible values of illum. */
   /* Highlight on. */
@@ -272,6 +275,14 @@ void MaterialWrap::store_image_textures(MTLMaterial &r_mtl_mat) const
       /* Find sockets linked to "Color" socket in normal map node. */
       linked_sockets_to_dest_id(normal_map_node, node_tree, "Color", linked_sockets);
     }
+    else if (texture_map.key == "map_Ke") {
+      float emission_strength = 0.0f;
+      copy_property_from_node(
+          SOCK_FLOAT, bsdf_node_, "Emission Strength", {&emission_strength, 1});
+      if (emission_strength == 0.0f) {
+        continue;
+      }
+    }
     else {
       /* Find sockets linked to the destination socket of interest, in p-bsdf node. */
       linked_sockets_to_dest_id(



More information about the Bf-blender-cvs mailing list