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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorAlex Strand <astrand130>2020-09-09 12:36:57 +0300
committerBrecht Van Lommel <brecht@blender.org>2020-09-17 19:54:04 +0300
commitb248ec97769fa654a3ee8bb2a643046b79e7c030 (patch)
tree57604691dd62e4b19b9df5d4109a8dc3f83bacb8 /intern
parent65fd005312848178509b0a0b0f3febf9f777f529 (diff)
Shaders: add emission strength input to Principled BSDF node
This impacts I/O add-ons. OBJ, FBX and Collada have been updated, glTF not yet. Differential Revision: https://developer.blender.org/D4971
Diffstat (limited to 'intern')
-rw-r--r--intern/cycles/render/nodes.cpp7
-rw-r--r--intern/cycles/render/nodes.h1
2 files changed, 6 insertions, 2 deletions
diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp
index de32ce53ad7..fc525e06d1e 100644
--- a/intern/cycles/render/nodes.cpp
+++ b/intern/cycles/render/nodes.cpp
@@ -2755,6 +2755,7 @@ NODE_DEFINE(PrincipledBsdfNode)
SOCKET_IN_FLOAT(transmission_roughness, "Transmission Roughness", 0.0f);
SOCKET_IN_FLOAT(anisotropic_rotation, "Anisotropic Rotation", 0.0f);
SOCKET_IN_COLOR(emission, "Emission", make_float3(0.0f, 0.0f, 0.0f));
+ SOCKET_IN_FLOAT(emission_strength, "Emission Strength", 1.0f);
SOCKET_IN_FLOAT(alpha, "Alpha", 1.0f);
SOCKET_IN_NORMAL(normal, "Normal", make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_NORMAL);
SOCKET_IN_NORMAL(clearcoat_normal,
@@ -2781,7 +2782,9 @@ void PrincipledBsdfNode::expand(ShaderGraph *graph)
ShaderOutput *principled_out = output("BSDF");
ShaderInput *emission_in = input("Emission");
- if (emission_in->link || emission != make_float3(0.0f, 0.0f, 0.0f)) {
+ ShaderInput *emission_strength_in = input("Emission Strength");
+ if ((emission_in->link || emission != make_float3(0.0f, 0.0f, 0.0f)) &&
+ (emission_strength_in->link || emission_strength != 0.0f)) {
/* Create add closure and emission. */
AddClosureNode *add = graph->create_node<AddClosureNode>();
EmissionNode *emission_node = graph->create_node<EmissionNode>();
@@ -2790,7 +2793,7 @@ void PrincipledBsdfNode::expand(ShaderGraph *graph)
graph->add(add);
graph->add(emission_node);
- emission_node->strength = 1.0f;
+ graph->relink(emission_strength_in, emission_node->input("Strength"));
graph->relink(emission_in, emission_node->input("Color"));
graph->relink(principled_out, new_out);
graph->connect(emission_node->output("Emission"), add->input("Closure1"));
diff --git a/intern/cycles/render/nodes.h b/intern/cycles/render/nodes.h
index 59e00231c2c..62dd9d843a8 100644
--- a/intern/cycles/render/nodes.h
+++ b/intern/cycles/render/nodes.h
@@ -580,6 +580,7 @@ class PrincipledBsdfNode : public BsdfBaseNode {
ClosureType distribution, distribution_orig;
ClosureType subsurface_method;
float3 emission;
+ float emission_strength;
float alpha;
bool has_integrator_dependency();