[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37653] trunk/blender/source/blender/ render/intern/source/render_texture.c: small fix, This enables correction of the tangent when normal mapping is in use and tangent lighting will be used

Michael Fox mfoxdogg at gmail.com
Mon Jun 20 05:37:42 CEST 2011


Revision: 37653
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37653
Author:   mfoxdogg
Date:     2011-06-20 03:37:41 +0000 (Mon, 20 Jun 2011)
Log Message:
-----------
small fix, This enables correction of the tangent when normal mapping is in use and tangent lighting will be used

Modified Paths:
--------------
    trunk/blender/source/blender/render/intern/source/render_texture.c

Modified: trunk/blender/source/blender/render/intern/source/render_texture.c
===================================================================
--- trunk/blender/source/blender/render/intern/source/render_texture.c	2011-06-20 03:24:07 UTC (rev 37652)
+++ trunk/blender/source/blender/render/intern/source/render_texture.c	2011-06-20 03:37:41 UTC (rev 37653)
@@ -2119,6 +2119,7 @@
 	float texvec[3], dxt[3], dyt[3], tempvec[3], norvec[3], warpvec[3]={0.0f, 0.0f, 0.0f}, Tnor=1.0;
 	int tex_nr, rgbnor= 0, warpdone=0;
 	int use_compat_bump = 0, use_ntap_bump = 0;
+	int found_nmapping = 0;
 	int iFirstTimeNMap=1;
 
 	compatible_bump_init(&compat_bump);
@@ -2429,6 +2430,9 @@
 					/* we need to code blending modes for normals too once.. now 1 exception hardcoded */
 					
 					if ((tex->type==TEX_IMAGE) && (tex->imaflag & TEX_NORMALMAP)) {
+						
+						found_nmapping = 1;
+						
 						/* qdn: for normalmaps, to invert the normalmap vector,
 						   it is better to negate x & y instead of subtracting the vector as was done before */
 						if (norfac < 0.0f) {
@@ -2620,7 +2624,7 @@
 			}
 		}
 	}
-	if ((use_compat_bump || use_ntap_bump) && (shi->mat->mode & MA_TANGENT_V)!=0) {
+	if ((use_compat_bump || use_ntap_bump || found_nmapping) && (shi->mat->mode & MA_TANGENT_V)!=0) {
 		const float fnegdot = -dot_v3v3(shi->vn, shi->tang);
 		// apply Gram-Schmidt projection
 		madd_v3_v3fl(shi->tang,  shi->vn, fnegdot);




More information about the Bf-blender-cvs mailing list