Cycles/ Layer Weight Node:
authorThomas Dinges <blender@dingto.org>
Fri, 19 Oct 2012 13:51:37 +0000 (13:51 +0000)
committerThomas Dinges <blender@dingto.org>
Fri, 19 Oct 2012 13:51:37 +0000 (13:51 +0000)
* Small tweak for the blend value, to avoid division by zero.

Thanks to Brecht for pointing out the solution.

intern/cycles/kernel/osl/nodes/node_layer_weight.osl
intern/cycles/kernel/svm/svm_fresnel.h

index dc3eb81d7122d7cf013c3634431f4c2527a74525..40b60fee7d3cbf77ec46fc5f82dd22b98a03a2cd 100644 (file)
@@ -36,7 +36,7 @@ shader node_layer_weight(
        Facing = abs(dot(I, Normal));
 
        if (blend != 0.5) {
-               blend = clamp(blend, 0.0, 1.0); 
+               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);
index 7684eabeecb1a63af53bf6334e27fb5651318303..d5b415a87ce4f9fcdadcbdb2a47688f2e88bc5a2 100644 (file)
@@ -54,7 +54,7 @@ __device void svm_node_layer_weight(ShaderData *sd, float *stack, uint4 node)
                f = fabsf(dot(sd->I, sd->N));
 
                if(blend != 0.5f) {
-                       blend = clamp(blend, 0.0f, 1.0f);
+                       blend = clamp(blend, 0.0f, 1.0f-1e-5f);
                        blend = (blend < 0.5f)? 2.0f*blend: 0.5f/(1.0f - blend);
 
                        f = powf(f, blend);