forked from bartvdbraak/blender
Cycles/ Layer Weight Node:
* Small tweak for the blend value, to avoid division by zero. Thanks to Brecht for pointing out the solution.
This commit is contained in:
parent
a75f11d036
commit
ef80ff105f
@ -36,7 +36,7 @@ shader node_layer_weight(
|
|||||||
Facing = abs(dot(I, Normal));
|
Facing = abs(dot(I, Normal));
|
||||||
|
|
||||||
if (blend != 0.5) {
|
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);
|
blend = (blend < 0.5) ? 2.0 * blend : 0.5 / (1.0 - blend);
|
||||||
|
|
||||||
Facing = pow(Facing, blend);
|
Facing = pow(Facing, blend);
|
||||||
|
@ -54,7 +54,7 @@ __device void svm_node_layer_weight(ShaderData *sd, float *stack, uint4 node)
|
|||||||
f = fabsf(dot(sd->I, sd->N));
|
f = fabsf(dot(sd->I, sd->N));
|
||||||
|
|
||||||
if(blend != 0.5f) {
|
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);
|
blend = (blend < 0.5f)? 2.0f*blend: 0.5f/(1.0f - blend);
|
||||||
|
|
||||||
f = powf(f, blend);
|
f = powf(f, blend);
|
||||||
|
Loading…
Reference in New Issue
Block a user