diff --git a/intern/cycles/util/util_transform.h b/intern/cycles/util/util_transform.h index 8f4e2b46616..4bf3759dd75 100644 --- a/intern/cycles/util/util_transform.h +++ b/intern/cycles/util/util_transform.h @@ -41,8 +41,9 @@ __device_inline float3 transform(const Transform *t, const float3 a) { float4 b = make_float4(a.x, a.y, a.z, 1.0f); float3 c = make_float3(dot(t->x, b), dot(t->y, b), dot(t->z, b)); + float w = dot(t->w, b); - return c/dot(t->w, b); + return (w != 0.0f)? c/w: make_float3(0.0f, 0.0f, 0.0f); } __device_inline float3 transform_direction(const Transform *t, const float3 a)