[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45592] trunk/blender/intern/cycles/util/ util_transform.cpp: Fix #30929: cycles rendering of object with scale 0 on some axis did not work

Brecht Van Lommel brechtvanlommel at pandora.be
Fri Apr 13 11:08:44 CEST 2012


Revision: 45592
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45592
Author:   blendix
Date:     2012-04-13 09:08:43 +0000 (Fri, 13 Apr 2012)
Log Message:
-----------
Fix #30929: cycles rendering of object with scale 0 on some axis did not work
correct with instancing.

Actually such object will not work in many places, e.g. transforming vertices
in edit mode doesn't work and textures will be misapplied in Blender Internal,
so these should be avoided.

Modified Paths:
--------------
    trunk/blender/intern/cycles/util/util_transform.cpp

Modified: trunk/blender/intern/cycles/util/util_transform.cpp
===================================================================
--- trunk/blender/intern/cycles/util/util_transform.cpp	2012-04-13 08:41:30 UTC (rev 45591)
+++ trunk/blender/intern/cycles/util/util_transform.cpp	2012-04-13 09:08:43 UTC (rev 45592)
@@ -134,9 +134,17 @@
 	R.T = transform_identity();
 	M.T = tfm;
 
-	if(!transform_matrix4_gj_inverse(R.M, M.M))
-		return transform_identity();
+	if(!transform_matrix4_gj_inverse(R.M, M.M)) {
+		/* matrix is degenerate (e.g. 0 scale on some axis), ideally we should
+		   never be in this situation, but try to invert it anyway with tweak */
+		M.M[0][0] += 1e-8f;
+		M.M[1][1] += 1e-8f;
+		M.M[2][2] += 1e-8f;
 
+		if(!transform_matrix4_gj_inverse(R.M, M.M))
+			return transform_identity();
+	}
+
 	return R.T;
 }
 




More information about the Bf-blender-cvs mailing list