diff --git a/intern/cycles/kernel/osl/shaders/node_principled_bsdf.osl b/intern/cycles/kernel/osl/shaders/node_principled_bsdf.osl index 1e36b447b93..d8ee3861d6c 100644 --- a/intern/cycles/kernel/osl/shaders/node_principled_bsdf.osl +++ b/intern/cycles/kernel/osl/shaders/node_principled_bsdf.osl @@ -29,7 +29,7 @@ shader node_principled_bsdf(string distribution = "multi_ggx", color CoatTint = color(1.0, 1.0, 1.0), float IOR = 1.45, float Transmission = 0.0, - color Emission = 1.0, + color EmissionColor = 1.0, float EmissionStrength = 0.0, float Alpha = 1.0, normal Normal = N, @@ -100,8 +100,8 @@ shader node_principled_bsdf(string distribution = "multi_ggx", BSDF = mix(BSDF, MetallicBSDF, clamp(Metallic, 0.0, 1.0)); } - if (EmissionStrength > 0.0 && Emission != color(0.0)) { - BSDF += EmissionStrength * Emission * emission(); + if (EmissionStrength > 0.0 && EmissionColor != color(0.0)) { + BSDF += EmissionStrength * EmissionColor * emission(); } if (Coat > 1e-5) { diff --git a/intern/cycles/scene/shader.cpp b/intern/cycles/scene/shader.cpp index 3a9a54cdb46..2d9561fe0ab 100644 --- a/intern/cycles/scene/shader.cpp +++ b/intern/cycles/scene/shader.cpp @@ -138,7 +138,7 @@ static float3 output_estimate_emission(ShaderOutput *output, bool &is_constant) { const bool is_principled = (node->type == PrincipledBsdfNode::get_node_type()); /* Emission and Background node. */ - ShaderInput *color_in = node->input(is_principled ? "Emission" : "Color"); + ShaderInput *color_in = node->input(is_principled ? "Emission Color" : "Color"); ShaderInput *strength_in = node->input(is_principled ? "Emission Strength" : "Strength"); if (is_principled) { diff --git a/intern/cycles/scene/shader_nodes.cpp b/intern/cycles/scene/shader_nodes.cpp index a34b7188814..44b102fbee2 100644 --- a/intern/cycles/scene/shader_nodes.cpp +++ b/intern/cycles/scene/shader_nodes.cpp @@ -2720,7 +2720,7 @@ NODE_DEFINE(PrincipledBsdfNode) SOCKET_IN_FLOAT(ior, "IOR", 0.0f); SOCKET_IN_FLOAT(transmission, "Transmission", 0.0f); SOCKET_IN_FLOAT(anisotropic_rotation, "Anisotropic Rotation", 0.0f); - SOCKET_IN_COLOR(emission, "Emission", one_float3()); + SOCKET_IN_COLOR(emission_color, "Emission Color", one_float3()); SOCKET_IN_FLOAT(emission_strength, "Emission Strength", 0.0f); SOCKET_IN_FLOAT(alpha, "Alpha", 1.0f); SOCKET_IN_NORMAL(normal, "Normal", zero_float3(), SocketType::LINK_NORMAL); @@ -2743,7 +2743,7 @@ void PrincipledBsdfNode::simplify_settings(Scene * /* scene */) { if (!has_surface_emission()) { /* Emission will be zero, so optimize away any connected emission input. */ - ShaderInput *emission_in = input("Emission"); + ShaderInput *emission_in = input("Emission Color"); ShaderInput *strength_in = input("Emission Strength"); if (emission_in->link) { emission_in->disconnect(); @@ -2762,9 +2762,9 @@ bool PrincipledBsdfNode::has_surface_transparent() bool PrincipledBsdfNode::has_surface_emission() { - ShaderInput *emission_in = input("Emission"); + ShaderInput *emission_color_in = input("Emission Color"); ShaderInput *emission_strength_in = input("Emission Strength"); - return (emission_in->link != NULL || reduce_max(emission) > CLOSURE_WEIGHT_CUTOFF) && + return (emission_color_in->link != NULL || reduce_max(emission_color) > CLOSURE_WEIGHT_CUTOFF) && (emission_strength_in->link != NULL || emission_strength > CLOSURE_WEIGHT_CUTOFF); } @@ -2825,7 +2825,7 @@ void PrincipledBsdfNode::compile(SVMCompiler &compiler) int subsurface_anisotropy_offset = compiler.stack_assign(input("Subsurface Anisotropy")); int alpha_offset = compiler.stack_assign_if_linked(alpha_in); int emission_strength_offset = compiler.stack_assign_if_linked(emission_strength_in); - int emission_offset = compiler.stack_assign(input("Emission")); + int emission_color_offset = compiler.stack_assign(input("Emission Color")); compiler.add_node(NODE_CLOSURE_BSDF, compiler.encode_uchar4(closure, @@ -2866,7 +2866,7 @@ void PrincipledBsdfNode::compile(SVMCompiler &compiler) compiler.add_node( compiler.encode_uchar4( - alpha_offset, emission_strength_offset, emission_offset, SVM_STACK_INVALID), + alpha_offset, emission_strength_offset, emission_color_offset, SVM_STACK_INVALID), __float_as_int(get_float(alpha_in->socket_type)), __float_as_int(get_float(emission_strength_in->socket_type)), SVM_STACK_INVALID); diff --git a/intern/cycles/scene/shader_nodes.h b/intern/cycles/scene/shader_nodes.h index 2948dd52931..387e1f0b111 100644 --- a/intern/cycles/scene/shader_nodes.h +++ b/intern/cycles/scene/shader_nodes.h @@ -546,7 +546,7 @@ class PrincipledBsdfNode : public BsdfBaseNode { NODE_SOCKET_API(float, surface_mix_weight) NODE_SOCKET_API(ClosureType, distribution) NODE_SOCKET_API(ClosureType, subsurface_method) - NODE_SOCKET_API(float3, emission) + NODE_SOCKET_API(float3, emission_color) NODE_SOCKET_API(float, emission_strength) NODE_SOCKET_API(float, alpha) diff --git a/scripts/modules/bpy_extras/node_shader_utils.py b/scripts/modules/bpy_extras/node_shader_utils.py index ce600999dea..96fd27a7203 100644 --- a/scripts/modules/bpy_extras/node_shader_utils.py +++ b/scripts/modules/bpy_extras/node_shader_utils.py @@ -468,14 +468,14 @@ class PrincipledBSDFWrapper(ShaderWrapper): def emission_color_get(self): if not self.use_nodes or self.node_principled_bsdf is None: return Color((0.0, 0.0, 0.0)) - return rgba_to_rgb(self.node_principled_bsdf.inputs["Emission"].default_value) + return rgba_to_rgb(self.node_principled_bsdf.inputs["Emission Color"].default_value) @_set_check def emission_color_set(self, color): if self.use_nodes and self.node_principled_bsdf is not None: color = values_clamp(color, 0.0, 1000000.0) color = rgb_to_rgba(color) - self.node_principled_bsdf.inputs["Emission"].default_value = color + self.node_principled_bsdf.inputs["Emission Color"].default_value = color emission_color = property(emission_color_get, emission_color_set) @@ -484,7 +484,7 @@ class PrincipledBSDFWrapper(ShaderWrapper): return None return ShaderImageTextureWrapper( self, self.node_principled_bsdf, - self.node_principled_bsdf.inputs["Emission"], + self.node_principled_bsdf.inputs["Emission Color"], grid_row_diff=1, ) diff --git a/source/blender/blenloader/intern/versioning_400.cc b/source/blender/blenloader/intern/versioning_400.cc index 7ec4879a59b..f7606971884 100644 --- a/source/blender/blenloader/intern/versioning_400.cc +++ b/source/blender/blenloader/intern/versioning_400.cc @@ -692,6 +692,12 @@ static void version_principled_bsdf_emission(bNodeTree *ntree) } } +/* Rename Principled BSDF emission to emission color. */ +static void version_principled_bsdf_emission_color(bNodeTree *ntree) +{ + version_node_input_socket_name(ntree, SH_NODE_BSDF_PRINCIPLED, "Emission", "Emission Color"); +} + /* Replace old Principled Hair BSDF as a variant in the new Principled Hair BSDF. */ static void version_replace_principled_hair_model(bNodeTree *ntree) { @@ -1423,6 +1429,8 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain) if (ntree->type == NTREE_SHADER) { /* Convert specular tint on the Principled BSDF. */ version_principled_bsdf_specular_tint(ntree); + /* Rename emission to emission color. */ + version_principled_bsdf_emission_color(ntree); } } FOREACH_NODETREE_END; diff --git a/source/blender/blenloader/intern/versioning_defaults.cc b/source/blender/blenloader/intern/versioning_defaults.cc index 41a6abc1564..195bcd43d30 100644 --- a/source/blender/blenloader/intern/versioning_defaults.cc +++ b/source/blender/blenloader/intern/versioning_defaults.cc @@ -609,7 +609,7 @@ void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template) if (node->type == SH_NODE_BSDF_PRINCIPLED) { bNodeSocket *roughness_socket = nodeFindSocket(node, SOCK_IN, "Roughness"); *version_cycles_node_socket_float_value(roughness_socket) = 0.5f; - bNodeSocket *emission = nodeFindSocket(node, SOCK_IN, "Emission"); + bNodeSocket *emission = nodeFindSocket(node, SOCK_IN, "Emission Color"); copy_v4_fl(version_cycles_node_socket_rgba_value(emission), 1.0f); bNodeSocket *emission_strength = nodeFindSocket(node, SOCK_IN, "Emission Strength"); *version_cycles_node_socket_float_value(emission_strength) = 0.0f; diff --git a/source/blender/io/collada/Materials.cpp b/source/blender/io/collada/Materials.cpp index d12229fd5ac..c4aad655761 100644 --- a/source/blender/io/collada/Materials.cpp +++ b/source/blender/io/collada/Materials.cpp @@ -330,7 +330,7 @@ void MaterialNode::set_emission(COLLADAFW::ColorOrTexture &cot) int locy = -300 * (node_map.size() - 2); if (cot.isColor()) { COLLADAFW::Color col = cot.getColor(); - bNodeSocket *socket = nodeFindSocket(shader_node, SOCK_IN, "Emission"); + bNodeSocket *socket = nodeFindSocket(shader_node, SOCK_IN, "Emission Color"); float *fcol = (float *)socket->default_value; fcol[0] = col.getRed(); @@ -340,9 +340,9 @@ void MaterialNode::set_emission(COLLADAFW::ColorOrTexture &cot) } // texture else if (cot.isTexture()) { - bNode *texture_node = add_texture_node(cot, -300, locy, "Emission"); + bNode *texture_node = add_texture_node(cot, -300, locy, "Emission Color"); if (texture_node != nullptr) { - add_link(texture_node, "Color", shader_node, "Emission"); + add_link(texture_node, "Color", shader_node, "Emission Color"); } } diff --git a/source/blender/io/collada/collada_utils.cpp b/source/blender/io/collada/collada_utils.cpp index 5e23df38e66..654e7179e04 100644 --- a/source/blender/io/collada/collada_utils.cpp +++ b/source/blender/io/collada/collada_utils.cpp @@ -1188,7 +1188,7 @@ COLLADASW::ColorOrTexture bc_get_emission(Material *ma) return bc_get_cot(default_color); } - COLLADASW::ColorOrTexture cot = bc_get_cot_from_shader(shader, "Emission", default_color); + COLLADASW::ColorOrTexture cot = bc_get_cot_from_shader(shader, "Emission Color", default_color); /* If using texture, emission strength is not supported. */ COLLADASW::Color col = cot.getColor(); diff --git a/source/blender/io/usd/intern/usd_reader_material.cc b/source/blender/io/usd/intern/usd_reader_material.cc index 31c3c064e3c..38758c6a3ed 100644 --- a/source/blender/io/usd/intern/usd_reader_material.cc +++ b/source/blender/io/usd/intern/usd_reader_material.cc @@ -465,7 +465,7 @@ void USDMaterialReader::set_principled_node_inputs(bNode *principled, } if (pxr::UsdShadeInput emissive_input = usd_shader.GetInput(usdtokens::emissiveColor)) { - set_node_input(emissive_input, principled, "Emission", ntree, column, &context); + set_node_input(emissive_input, principled, "Emission Color", ntree, column, &context); } if (pxr::UsdShadeInput specular_input = usd_shader.GetInput(usdtokens::specularColor)) { diff --git a/source/blender/io/usd/intern/usd_writer_material.cc b/source/blender/io/usd/intern/usd_writer_material.cc index a85e22e7f01..d5bc446ec30 100644 --- a/source/blender/io/usd/intern/usd_writer_material.cc +++ b/source/blender/io/usd/intern/usd_writer_material.cc @@ -292,7 +292,7 @@ static InputSpecMap &preview_surface_input_map() { static InputSpecMap input_map = { {"Base Color", {usdtokens::diffuse_color, pxr::SdfValueTypeNames->Float3, true}}, - {"Emission", {usdtokens::emissive_color, pxr::SdfValueTypeNames->Float3, true}}, + {"Emission Color", {usdtokens::emissive_color, pxr::SdfValueTypeNames->Float3, true}}, {"Color", {usdtokens::diffuse_color, pxr::SdfValueTypeNames->Float3, true}}, {"Roughness", {usdtokens::roughness, pxr::SdfValueTypeNames->Float, true}}, {"Metallic", {usdtokens::metallic, pxr::SdfValueTypeNames->Float, true}}, diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_mtl.cc b/source/blender/io/wavefront_obj/exporter/obj_export_mtl.cc index 01c4ab26834..497c7d1ded9 100644 --- a/source/blender/io/wavefront_obj/exporter/obj_export_mtl.cc +++ b/source/blender/io/wavefront_obj/exporter/obj_export_mtl.cc @@ -32,7 +32,7 @@ const char *tex_map_type_to_socket_id[] = { "Roughness", "Sheen", "Metallic", /* Map reflection to metallic. */ - "Emission", + "Emission Color", "Alpha", "Normal", }; @@ -232,7 +232,7 @@ static void store_bsdf_properties(const bNode *bsdf_node, float emission_strength = 0.0f; if (bsdf_node) { 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}); + copy_property_from_node(SOCK_RGBA, bsdf_node, "Emission Color", {emission_col, 3}); } mul_v3_fl(emission_col, emission_strength); diff --git a/source/blender/io/wavefront_obj/importer/obj_import_mtl.cc b/source/blender/io/wavefront_obj/importer/obj_import_mtl.cc index ce7020c6792..f0d8a0888b6 100644 --- a/source/blender/io/wavefront_obj/importer/obj_import_mtl.cc +++ b/source/blender/io/wavefront_obj/importer/obj_import_mtl.cc @@ -302,7 +302,7 @@ static void set_bsdf_socket_values(bNode *bsdf, Material *mat, const MTLMaterial float3 emission_color = mtl_mat.emission_color; if (emission_color.x >= 0 && emission_color.y >= 0 && emission_color.z >= 0) { - set_property_of_socket(SOCK_RGBA, "Emission", {emission_color, 3}, bsdf); + set_property_of_socket(SOCK_RGBA, "Emission Color", {emission_color, 3}, bsdf); } if (mtl_mat.tex_map_of_type(MTLTexMapType::Emission).is_valid()) { set_property_of_socket(SOCK_FLOAT, "Emission Strength", {1.0f}, bsdf); diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.cc index f6c75b387d5..7e5f915a54b 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.cc @@ -184,7 +184,7 @@ static void node_declare(NodeDeclarationBuilder &b) /* Panel for Emission settings. */ PanelDeclarationBuilder &emis = b.add_panel("Emission").default_closed(true); - emis.add_input("Emission").default_value({1.0f, 1.0f, 1.0f, 1.0f}); + emis.add_input("Emission Color").default_value({1.0f, 1.0f, 1.0f, 1.0f}); #define SOCK_EMISSION_ID 27 emis.add_input("Emission Strength").default_value(0.0).min(0.0f).max(1000000.0f); #define SOCK_EMISSION_STRENGTH_ID 28