Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Fox <mfoxdogg@gmail.com>2011-06-20 07:37:41 +0400
committerMichael Fox <mfoxdogg@gmail.com>2011-06-20 07:37:41 +0400
commit3e76245eb20288ec293ee43a7ea43de70cdc21ae (patch)
tree3362bf25a1d0536a1e6d11538da842f4f25c490c /source/blender
parent09fc9257e1420879bde42b249bc3750fde31b14d (diff)
small fix, This enables correction of the tangent when normal mapping is in use and tangent lighting will be used
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/render/intern/source/render_texture.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c
index 43e6043366c..5aad055a8f6 100644
--- a/source/blender/render/intern/source/render_texture.c
+++ b/source/blender/render/intern/source/render_texture.c
@@ -2119,6 +2119,7 @@ void do_material_tex(ShadeInput *shi)
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 @@ void do_material_tex(ShadeInput *shi)
/* 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 @@ void do_material_tex(ShadeInput *shi)
}
}
}
- 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);