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);
 }
 


_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to