[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16684] trunk/blender/source/blender/ render/intern/source/shadeinput.c: Fix for bug #11163: strand render without tangent shading didn't

Brecht Van Lommel brecht at blender.org
Mon Sep 22 21:37:31 CEST 2008


Revision: 16684
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16684
Author:   blendix
Date:     2008-09-22 21:37:30 +0200 (Mon, 22 Sep 2008)

Log Message:
-----------
Fix for bug #11163: strand render without tangent shading didn't
give correct results.

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

Modified: trunk/blender/source/blender/render/intern/source/shadeinput.c
===================================================================
--- trunk/blender/source/blender/render/intern/source/shadeinput.c	2008-09-22 19:09:46 UTC (rev 16683)
+++ trunk/blender/source/blender/render/intern/source/shadeinput.c	2008-09-22 19:37:30 UTC (rev 16684)
@@ -343,11 +343,20 @@
 	VECCOPY(shi->orignor, shi->facenor);
 
 	/* shade_input_set_normals equivalent */
-	if(shi->mat->mode & MA_TANGENT_STR)
+	if(shi->mat->mode & MA_TANGENT_STR) {
 		VECCOPY(shi->vn, spoint->tan)
-	else
-		VECCOPY(shi->vn, spoint->nor)
+	}
+	else {
+		float cross[3];
 
+		Crossf(cross, spoint->co, spoint->tan);
+		Crossf(shi->vn, cross, spoint->tan);
+		Normalize(shi->vn);
+
+		if(INPR(shi->vn, shi->view) < 0.0f)
+			VecMulf(shi->vn, -1.0f);
+	}
+
 	VECCOPY(shi->vno, shi->vn);
 }
 





More information about the Bf-blender-cvs mailing list