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:
Diffstat (limited to 'intern/cycles/kernel/shaders/node_layer_weight.osl')
-rw-r--r--intern/cycles/kernel/shaders/node_layer_weight.osl37
1 files changed, 18 insertions, 19 deletions
diff --git a/intern/cycles/kernel/shaders/node_layer_weight.osl b/intern/cycles/kernel/shaders/node_layer_weight.osl
index f583df25773..7c46f28b41b 100644
--- a/intern/cycles/kernel/shaders/node_layer_weight.osl
+++ b/intern/cycles/kernel/shaders/node_layer_weight.osl
@@ -17,29 +17,28 @@
#include "stdosl.h"
#include "node_fresnel.h"
-shader node_layer_weight(
- float Blend = 0.5,
- normal Normal = N,
- output float Fresnel = 0.0,
- output float Facing = 0.0)
+shader node_layer_weight(float Blend = 0.5,
+ normal Normal = N,
+ output float Fresnel = 0.0,
+ output float Facing = 0.0)
{
- float blend = Blend;
- float cosi = dot(I, Normal);
+ float blend = Blend;
+ float cosi = dot(I, Normal);
- /* Fresnel */
- float eta = max(1.0 - Blend, 1e-5);
- eta = backfacing() ? eta : 1.0 / eta;
- Fresnel = fresnel_dielectric_cos(cosi, eta);
+ /* Fresnel */
+ float eta = max(1.0 - Blend, 1e-5);
+ eta = backfacing() ? eta : 1.0 / eta;
+ Fresnel = fresnel_dielectric_cos(cosi, eta);
- /* Facing */
- Facing = fabs(cosi);
+ /* Facing */
+ Facing = fabs(cosi);
- if (blend != 0.5) {
- blend = clamp(blend, 0.0, 1.0 - 1e-5);
- blend = (blend < 0.5) ? 2.0 * blend : 0.5 / (1.0 - blend);
+ if (blend != 0.5) {
+ blend = clamp(blend, 0.0, 1.0 - 1e-5);
+ blend = (blend < 0.5) ? 2.0 * blend : 0.5 / (1.0 - blend);
- Facing = pow(Facing, blend);
- }
+ Facing = pow(Facing, blend);
+ }
- Facing = 1.0 - Facing;
+ Facing = 1.0 - Facing;
}