diff options
Diffstat (limited to 'intern/cycles')
-rw-r--r-- | intern/cycles/kernel/osl/nodes/CMakeLists.txt | 1 | ||||
-rw-r--r-- | intern/cycles/kernel/osl/nodes/node_layer_weight.osl (renamed from intern/cycles/kernel/osl/nodes/node_blend_weight.osl) | 21 | ||||
-rw-r--r-- | intern/cycles/render/nodes.cpp | 2 |
3 files changed, 15 insertions, 9 deletions
diff --git a/intern/cycles/kernel/osl/nodes/CMakeLists.txt b/intern/cycles/kernel/osl/nodes/CMakeLists.txt index cb965ac1530..65b8504ce43 100644 --- a/intern/cycles/kernel/osl/nodes/CMakeLists.txt +++ b/intern/cycles/kernel/osl/nodes/CMakeLists.txt @@ -29,6 +29,7 @@ set(SRC_OSL node_hsv.osl node_image_texture.osl node_invert.osl + node_layer_weight.osl node_light_path.osl node_light_falloff.osl node_magic_texture.osl diff --git a/intern/cycles/kernel/osl/nodes/node_blend_weight.osl b/intern/cycles/kernel/osl/nodes/node_layer_weight.osl index 836897fc5e3..ea25d0c0e02 100644 --- a/intern/cycles/kernel/osl/nodes/node_blend_weight.osl +++ b/intern/cycles/kernel/osl/nodes/node_layer_weight.osl @@ -19,22 +19,27 @@ #include "stdosl.h" #include "node_fresnel.h" -shader node_blend_weight( - float Blend = 0.3, +shader node_layer_weight( + float Blend = 0.5, normal Normal = N, output float Fresnel = 0.0, output float Facing = 0.0) { - float f = max(1.0 - Blend, 1e-5); - Fresnel = fresnel_dielectric(I, Normal, backfacing()? f: 1.0 / f); + float blend = Blend; + /* Fresnel */ + float eta = max(1.0 - Blend, 1e-5); + eta = backfacing()? eta: 1.0 / eta; + Fresnel = fresnel_dielectric(I, Normal, eta); + + /* Facing */ Facing = abs(dot(I, Normal)); - if (Blend != 0.5) { - Blend = clamp(Blend, 0.0, 1.0); - Blend = (Blend < 0.5)? 2.0 * Blend: 0.5 / (1.0 - Blend); + if (blend != 0.5) { + blend = clamp(blend, 0.0, 1.0); + blend = (blend < 0.5)? 2.0 * blend: 0.5 / (1.0 - blend); - Facing = powf(Facing, Blend); + Facing = pow(Facing, blend); } Facing = 1.0 - Facing; diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp index ef139d994da..6030c9f49c1 100644 --- a/intern/cycles/render/nodes.cpp +++ b/intern/cycles/render/nodes.cpp @@ -2579,7 +2579,7 @@ void LayerWeightNode::compile(SVMCompiler& compiler) void LayerWeightNode::compile(OSLCompiler& compiler) { - compiler.add(this, "node_blend_weight"); + compiler.add(this, "node_layer_weight"); } /* Output */ |