Fix: NaN in vector math node in refract mode

Fix a NaN that can occur in the vector math node when set to
refract mode with a 'normal' input of length zero.

Pull Request: https://projects.blender.org/blender/blender/pulls/125374
This commit is contained in:
Alaska
2024-07-26 12:04:58 +02:00
committed by Sergey Sharybin
parent 9afe70968d
commit 8650068f0c
2 changed files with 2 additions and 2 deletions

View File

@@ -37,7 +37,7 @@ ccl_device void svm_vector_math(ccl_private float *value,
*vector = reflect(a, b);
break;
case NODE_VECTOR_MATH_REFRACT:
*vector = refract(a, normalize(b), param1);
*vector = refract(a, safe_normalize(b), param1);
break;
case NODE_VECTOR_MATH_FACEFORWARD:
*vector = faceforward(a, b, c);