Shaders: rename Principled BSDF Emission to Emission Color

Ref #99447
Ref #112848
This commit is contained in:
Brecht Van Lommel
2023-09-22 17:05:47 +02:00
parent def9b76207
commit ca5f1c0f00
14 changed files with 33 additions and 25 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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");
}
}

View File

@@ -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();

View File

@@ -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)) {

View File

@@ -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}},

View File

@@ -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);

View File

@@ -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);

View File

@@ -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<decl::Color>("Emission").default_value({1.0f, 1.0f, 1.0f, 1.0f});
emis.add_input<decl::Color>("Emission Color").default_value({1.0f, 1.0f, 1.0f, 1.0f});
#define SOCK_EMISSION_ID 27
emis.add_input<decl::Float>("Emission Strength").default_value(0.0).min(0.0f).max(1000000.0f);
#define SOCK_EMISSION_STRENGTH_ID 28