Commit: d7ceca8c934d098832191d6ae6bd2b08dd552d89
Author: Brecht Van Lommel
Date:   Sun Oct 11 20:25:33 2015 +0200
Branches: master
https://developer.blender.org/rBd7ceca8c934d098832191d6ae6bd2b08dd552d89

Fix T46085: UV project modifier artifacts with vertices behind the camera.

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

M       source/blender/blenlib/intern/math_matrix.c

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

diff --git a/source/blender/blenlib/intern/math_matrix.c 
b/source/blender/blenlib/intern/math_matrix.c
index 8e41a86..7866260 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -516,7 +516,8 @@ void mul_v3_mat3_m4v3(float r[3], float mat[4][4], const 
float vec[3])
 
 void mul_project_m4_v3(float mat[4][4], float vec[3])
 {
-       const float w = mul_project_m4_v3_zfac(mat, vec);
+       /* absolute value to not flip the frustum upside down behind the camera 
*/
+       const float w = fabsf(mul_project_m4_v3_zfac(mat, vec));
        mul_m4_v3(mat, vec);
 
        vec[0] /= w;
@@ -526,7 +527,7 @@ void mul_project_m4_v3(float mat[4][4], float vec[3])
 
 void mul_v3_project_m4_v3(float r[3], float mat[4][4], const float vec[3])
 {
-       const float w = mul_project_m4_v3_zfac(mat, vec);
+       const float w = fabsf(mul_project_m4_v3_zfac(mat, vec));
        mul_v3_m4v3(r, mat, vec);
 
        r[0] /= w;
@@ -536,7 +537,7 @@ void mul_v3_project_m4_v3(float r[3], float mat[4][4], 
const float vec[3])
 
 void mul_v2_project_m4_v3(float r[2], float mat[4][4], const float vec[3])
 {
-       const float w = mul_project_m4_v3_zfac(mat, vec);
+       const float w = fabsf(mul_project_m4_v3_zfac(mat, vec));
        mul_v2_m4v3(r, mat, vec);
 
        r[0] /= w;

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

Reply via email to