From 0b49dc77deaa5e4bf148be4e17ae73119e6aa769 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 21 Jul 2009 13:46:49 +0000 Subject: 2.5: Bump Mapping Patch by Alfredo de Greef. Considerably improves the quality of bump mapping, and texture filtering for displacement and warp too. Mainly this is achieved by getting the texture derivatives just right in various cases, many thanks to Alfredo for figuring this one out, works great. This is enabled by default now, but disabled still for existing textures to preserve backwards compatibility. Can be enabled with the "New Bump" option in the material texture slot in the outliner. Also, I made the range for the normal factor a bit smaller since this gives stronger effects, but note that you can still type in larger values than the slider allows. --- source/blender/blenloader/intern/readfile.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'source/blender/blenloader') diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 6da444bc88e..bbe85c5f378 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -9276,7 +9276,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) Tex *tex; Scene *sce; ToolSettings *ts; - int i; + int i, a; for(ob = main->object.first; ob; ob = ob->id.next) { @@ -9351,15 +9351,26 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } /* texture filter */ - for(tex = main->tex.first; tex; tex = tex->id.next) + for(tex = main->tex.first; tex; tex = tex->id.next) { if(tex->afmax == 0) tex->afmax= 8; + } for(ma = main->mat.first; ma; ma = ma->id.next) { if(ma->mode & MA_HALO) { ma->material_type= MA_TYPE_HALO; ma->mode &= ~MA_HALO; } + + /* set new bump for unused slots */ + for(a=0; amtex[a]) { + if(!ma->mtex[a]->tex) + ma->mtex[a]->texflag |= MTEX_NEW_BUMP; + else if(((Tex*)newlibadr(fd, ma->id.lib, ma->mtex[a]->tex))->type == 0) + ma->mtex[a]->texflag |= MTEX_NEW_BUMP; + } + } } for(sce = main->scene.first; sce; sce = sce->id.next) { -- cgit v1.2.3