diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-01-07 17:42:01 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-01-07 17:42:01 +0300 |
commit | c8e0ca44a3c5d49be01f90a49b98a9ee8f875d36 (patch) | |
tree | 188ab5686fd7b27a258fd0b19d4ba4467f57b14a /source/blender/blenkernel | |
parent | 03e0f28ea054923d1bb682ad8cd6ee931caea89f (diff) |
Improved bump mapping patch by M.G. Kishalmi (lmg) and M.S. Mikkelsen (sparky).
Many thanks to them!
For comparison, see here:
http://kishalmi.servus.at/3D/bumpcode/
Based on algorithm in: Mikkelsen M. S.: Simulation of Wrinkled Surfaces Revisited.
http://jbit.net/~sparky/sfgrad_bump/mm_sfgrad_bump.pdf
This fixes bugs:
#24591: Artefacts/strange normal mapping when anti-aliasing is on
#24735: Error at the Normal function.
#24962: Normals are not calculated correctly if anti-aliasing is off
#25103: Weird artefacts in Normal
This will break render compatibility a bit, but fixing this bugs would have also
done that, so in this case it should be acceptable.
Patch committed with these modifications:
* Bump method Old/3-Tap/5-Tap option in UI, 3-Tap is default
* Only compute normal perturbation vectors when needed
* Fix some middle of block variable definitions for MSVC
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/material.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 2d123302c3d..c8fb921285c 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -816,10 +816,10 @@ static void do_init_render_material(Material *ma, int r_mode, float *amb) ma->texco |= mtex->texco; ma->mapto |= mtex->mapto; - if(r_mode & R_OSA) { - if ELEM3(mtex->tex->type, TEX_IMAGE, TEX_PLUGIN, TEX_ENVMAP) ma->texco |= TEXCO_OSA; - else if(mtex->texflag & MTEX_NEW_BUMP) ma->texco |= TEXCO_OSA; // NEWBUMP: need texture derivatives for procedurals as well - } + + /* always get derivatives for these textures */ + if ELEM3(mtex->tex->type, TEX_IMAGE, TEX_PLUGIN, TEX_ENVMAP) ma->texco |= TEXCO_OSA; + else if(mtex->texflag & MTEX_NEW_BUMP) ma->texco |= TEXCO_OSA; if(ma->texco & (TEXCO_ORCO|TEXCO_REFL|TEXCO_NORM|TEXCO_STRAND|TEXCO_STRESS)) needuv= 1; else if(ma->texco & (TEXCO_GLOB|TEXCO_UV|TEXCO_OBJECT|TEXCO_SPEED)) needuv= 1; |