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
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-02-08 18:19:04 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-02-09 21:58:42 +0300
commita6968e87f1338081f30725f8f2ca3460e280fea2 (patch)
tree0fdc61c15c86953fb431894871e7cf0a75dc5031 /intern/cycles/render
parent0df9b2c71517a98760a5e577f434d9d86e4e1910 (diff)
Cycles: add random walk subsurface scattering to Principled BSDF.
Differential Revision: https://developer.blender.org/D3054
Diffstat (limited to 'intern/cycles/render')
-rw-r--r--intern/cycles/render/nodes.cpp9
-rw-r--r--intern/cycles/render/nodes.h1
2 files changed, 9 insertions, 1 deletions
diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp
index 7e8298e09c1..cb884ba9231 100644
--- a/intern/cycles/render/nodes.cpp
+++ b/intern/cycles/render/nodes.cpp
@@ -2312,6 +2312,12 @@ NODE_DEFINE(PrincipledBsdfNode)
distribution_enum.insert("GGX", CLOSURE_BSDF_MICROFACET_GGX_GLASS_ID);
distribution_enum.insert("Multiscatter GGX", CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_ID);
SOCKET_ENUM(distribution, "Distribution", distribution_enum, CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_ID);
+
+ static NodeEnum subsurface_method_enum;
+ subsurface_method_enum.insert("burley", CLOSURE_BSSRDF_PRINCIPLED_ID);
+ subsurface_method_enum.insert("random_walk", CLOSURE_BSSRDF_PRINCIPLED_RANDOM_WALK_ID);
+ SOCKET_ENUM(subsurface_method, "Subsurface Method", subsurface_method_enum, CLOSURE_BSSRDF_PRINCIPLED_ID);
+
SOCKET_IN_COLOR(base_color, "Base Color", make_float3(0.8f, 0.8f, 0.8f));
SOCKET_IN_COLOR(subsurface_color, "Subsurface Color", make_float3(0.8f, 0.8f, 0.8f));
SOCKET_IN_FLOAT(metallic, "Metallic", 0.0f);
@@ -2410,7 +2416,7 @@ void PrincipledBsdfNode::compile(SVMCompiler& compiler, ShaderInput *p_metallic,
compiler.encode_uchar4(sheen_offset, sheen_tint_offset, clearcoat_offset, clearcoat_roughness_offset));
compiler.add_node(compiler.encode_uchar4(ior_offset, transmission_offset, anisotropic_rotation_offset, transmission_roughness_offset),
- distribution, SVM_STACK_INVALID, SVM_STACK_INVALID);
+ distribution, subsurface_method, SVM_STACK_INVALID);
float3 bc_default = get_float3(base_color_in->socket_type);
@@ -2442,6 +2448,7 @@ void PrincipledBsdfNode::compile(SVMCompiler& compiler)
void PrincipledBsdfNode::compile(OSLCompiler& compiler)
{
compiler.parameter(this, "distribution");
+ compiler.parameter(this, "subsurface_method");
compiler.add(this, "node_principled_bsdf");
}
diff --git a/intern/cycles/render/nodes.h b/intern/cycles/render/nodes.h
index a00b48ca5bc..f664ebf545d 100644
--- a/intern/cycles/render/nodes.h
+++ b/intern/cycles/render/nodes.h
@@ -390,6 +390,7 @@ public:
float3 normal, clearcoat_normal, tangent;
float surface_mix_weight;
ClosureType distribution, distribution_orig;
+ ClosureType subsurface_method;
bool has_integrator_dependency();
void attributes(Shader *shader, AttributeRequestSet *attributes);