diff options
author | Morten Mikkelsen <mikkelsen7@gmail.com> | 2011-08-18 21:25:54 +0400 |
---|---|---|
committer | Morten Mikkelsen <mikkelsen7@gmail.com> | 2011-08-18 21:25:54 +0400 |
commit | ccdec67fec8a39b8239e93bd04e38b4d8cbd18e7 (patch) | |
tree | 0885a3664a203a2b9acc318293f6609188d3bda5 /source/blender | |
parent | 39a46cd4ed049bc462359f920af469c491b687f9 (diff) |
bugfix: genx and geny are not the image resolution. Texture space variant needs this.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/render/intern/source/render_texture.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c index 5aad055a8f6..579afc21c1d 100644 --- a/source/blender/render/intern/source/render_texture.c +++ b/source/blender/render/intern/source/render_texture.c @@ -2084,14 +2084,21 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T if( mtex->texflag & MTEX_BUMP_TEXTURESPACE ) { if(tex->ima) { - // crazy hack solution that gives results similar to normal mapping - part 2 float vec[2]; + int dimx=512, dimy=512; + ImBuf* ibuf = BKE_image_get_ibuf(tex->ima, &tex->iuser); + if (ibuf) { + dimx = ibuf->x; + dimy = ibuf->y; + } + + // crazy hack solution that gives results similar to normal mapping - part 2 - vec[0] = tex->ima->gen_x*dxt[0]; - vec[1] = tex->ima->gen_y*dxt[1]; + vec[0] = dimx*dxt[0]; + vec[1] = dimy*dxt[1]; dHdx *= 1.0f/len_v2(vec); - vec[0] = tex->ima->gen_x*dyt[0]; - vec[1] = tex->ima->gen_y*dyt[1]; + vec[0] = dimx*dyt[0]; + vec[1] = dimy*dyt[1]; dHdy *= 1.0f/len_v2(vec); } } |