Commit: 4974ed93ef50437084e6d3b03530fffdc58ea834
Author: Sergey Sharybin
Date:   Thu Oct 8 21:14:14 2015 +0500
Branches: master
https://developer.blender.org/rB4974ed93ef50437084e6d3b03530fffdc58ea834

Cycles: Fix issues with quick inverse of degenerate matrix

This fixes part of the issues reported in T46322. Still need to solve
issue with wrong intersection distance scaling.

===================================================================

M       intern/cycles/util/util_transform.h

===================================================================

diff --git a/intern/cycles/util/util_transform.h 
b/intern/cycles/util/util_transform.h
index ba8d04b..4450273 100644
--- a/intern/cycles/util/util_transform.h
+++ b/intern/cycles/util/util_transform.h
@@ -347,7 +347,12 @@ ccl_device_inline Transform 
transform_quick_inverse(Transform M)
         * scale can be inverted but what about shearing? */
        Transform R;
        float det = M.x.x*(M.z.z*M.y.y - M.z.y*M.y.z) - M.y.x*(M.z.z*M.x.y - 
M.z.y*M.x.z) + M.z.x*(M.y.z*M.x.y - M.y.y*M.x.z);
-
+       if(det == 0.0f) {
+               M[0][0] += 1e-8f;
+               M[1][1] += 1e-8f;
+               M[2][2] += 1e-8f;
+               det = M.x.x*(M.z.z*M.y.y - M.z.y*M.y.z) - M.y.x*(M.z.z*M.x.y - 
M.z.y*M.x.z) + M.z.x*(M.y.z*M.x.y - M.y.y*M.x.z);
+       }
        det = (det != 0.0f)? 1.0f/det: 0.0f;
 
        float3 Rx = det*make_float3(M.z.z*M.y.y - M.z.y*M.y.z, M.z.y*M.x.z - 
M.z.z*M.x.y, M.y.z*M.x.y - M.y.y*M.x.z);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to