From e77b666ae9618ce3bb850edfef428e28b9eb5d6c Mon Sep 17 00:00:00 2001 From: Weizhen Huang Date: Thu, 23 Mar 2023 12:33:56 +0100 Subject: [PATCH] Fix normalize zero vector in light tree #OrientationBounds was assuming such cases are already handled before this function is called, but seems to be broken on windows and linux. Do `safe_normalize()` so the tests pass, will check the problem afterwards. --- intern/cycles/scene/light_tree.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intern/cycles/scene/light_tree.cpp b/intern/cycles/scene/light_tree.cpp index 37d1c3ae791..5fe49311c59 100644 --- a/intern/cycles/scene/light_tree.cpp +++ b/intern/cycles/scene/light_tree.cpp @@ -57,7 +57,7 @@ OrientationBounds merge(const OrientationBounds &cone_a, const OrientationBounds /* Rotate new axis to be between a and b. */ float theta_r = theta_o - a->theta_o; - float3 new_axis = rotate_around_axis(a->axis, normalize(cross(a->axis, b->axis)), theta_r); + float3 new_axis = rotate_around_axis(a->axis, safe_normalize(cross(a->axis, b->axis)), theta_r); new_axis = normalize(new_axis); return OrientationBounds({new_axis, theta_o, theta_e});