Fix for bug #12077: tangent shading (which only affects specular) made
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Thu, 22 May 2008 15:30:35 +0000 (15:30 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Thu, 22 May 2008 15:30:35 +0000 (15:30 +0000)
bump mapping not work for diffuse.

source/blender/render/intern/source/texture.c

index 3d448b66e930ad1285030aeb5808e87cbb3955db..27628d914653024ac64a3c6d43e830bf524a13dd 100644 (file)
@@ -1844,24 +1844,24 @@ void do_material_tex(ShadeInput *shi)
                                                }
                                        }
                                        else {
+                                               float nor[3], dot;
+
                                                if(shi->mat->mode & MA_TANGENT_V) {
                                                        shi->tang[0]+= Tnor*tex->norfac*texres.nor[0];
                                                        shi->tang[1]+= Tnor*tex->norfac*texres.nor[1];
                                                        shi->tang[2]+= Tnor*tex->norfac*texres.nor[2];
                                                }
-                                               else {
-                                                       float nor[3], dot;
-                                                       /* prevent bump to become negative normal */
-                                                       nor[0]= Tnor*tex->norfac*texres.nor[0];
-                                                       nor[1]= Tnor*tex->norfac*texres.nor[1];
-                                                       nor[2]= Tnor*tex->norfac*texres.nor[2];
-                                                       
-                                                       dot= 0.5f + 0.5f*INPR(nor, shi->vn);
-                                                       
-                                                       shi->vn[0]+= dot*nor[0];
-                                                       shi->vn[1]+= dot*nor[1];
-                                                       shi->vn[2]+= dot*nor[2];
-                                               }
+
+                                               /* prevent bump to become negative normal */
+                                               nor[0]= Tnor*tex->norfac*texres.nor[0];
+                                               nor[1]= Tnor*tex->norfac*texres.nor[1];
+                                               nor[2]= Tnor*tex->norfac*texres.nor[2];
+                                               
+                                               dot= 0.5f + 0.5f*INPR(nor, shi->vn);
+                                               
+                                               shi->vn[0]+= dot*nor[0];
+                                               shi->vn[1]+= dot*nor[1];
+                                               shi->vn[2]+= dot*nor[2];
                                        }                                       
                                        Normalize(shi->vn);