[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34565] trunk/blender/source/blender/ render/intern/source/texture.c: Bugfix #25855
Ton Roosendaal
ton at blender.org
Sun Jan 30 15:19:13 CET 2011
Revision: 34565
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=34565
Author: ton
Date: 2011-01-30 14:19:12 +0000 (Sun, 30 Jan 2011)
Log Message:
-----------
Bugfix #25855
New bump code: option "Texture space" only works for image textures.
It appears this option is some kind of "fake normal map" actually.
Needs nicer name... maybe "Image space".
Now it ignores the option when no image texture is used.
Modified Paths:
--------------
trunk/blender/source/blender/render/intern/source/texture.c
Modified: trunk/blender/source/blender/render/intern/source/texture.c
===================================================================
--- trunk/blender/source/blender/render/intern/source/texture.c 2011-01-30 13:51:02 UTC (rev 34564)
+++ trunk/blender/source/blender/render/intern/source/texture.c 2011-01-30 14:19:12 UTC (rev 34565)
@@ -1912,7 +1912,8 @@
// TODO: solve this Hscale issue more elegantly.
if( mtex->texflag & MTEX_BUMP_TEXTURESPACE )
- Hscale *= 130.0f;
+ if(tex->ima)
+ Hscale *= 130.0f;
if(!(mtex->texflag & MTEX_5TAP_BUMP)) {
// compute height derivatives with respect to output image pixel coordinates x and y
@@ -2033,10 +2034,12 @@
abs_fDet = ntap_bump->sgn_det * fDet;
if( mtex->texflag & MTEX_BUMP_TEXTURESPACE ) {
- // crazy hack solution that gives results similar to normal mapping - part 1
- normalize_v3(ntap_bump->vR1);
- normalize_v3(ntap_bump->vR2);
- abs_fDet = 1.0f;
+ if(tex->ima) {
+ // crazy hack solution that gives results similar to normal mapping - part 1
+ normalize_v3(ntap_bump->vR1);
+ normalize_v3(ntap_bump->vR2);
+ abs_fDet = 1.0f;
+ }
}
for(xyz=0; xyz<3; xyz++)
@@ -2053,14 +2056,17 @@
}
if( mtex->texflag & MTEX_BUMP_TEXTURESPACE ) {
- // crazy hack solution that gives results similar to normal mapping - part 2
- float vec[2];
- vec[0] = tex->ima->gen_x*dxt[0];
- vec[1] = tex->ima->gen_y*dxt[1];
- dHdx *= 1.0f/len_v2(vec);
- vec[0] = tex->ima->gen_x*dyt[0];
- vec[1] = tex->ima->gen_y*dyt[1];
- dHdy *= 1.0f/len_v2(vec);
+ if(tex->ima) {
+ // crazy hack solution that gives results similar to normal mapping - part 2
+ float vec[2];
+
+ vec[0] = tex->ima->gen_x*dxt[0];
+ vec[1] = tex->ima->gen_y*dxt[1];
+ dHdx *= 1.0f/len_v2(vec);
+ vec[0] = tex->ima->gen_x*dyt[0];
+ vec[1] = tex->ima->gen_y*dyt[1];
+ dHdy *= 1.0f/len_v2(vec);
+ }
}
// subtract the surface gradient from vNacc
More information about the Bf-blender-cvs
mailing list