diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-07-21 17:46:49 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-07-21 17:46:49 +0400 |
commit | 0b49dc77deaa5e4bf148be4e17ae73119e6aa769 (patch) | |
tree | eff1000f20029183267b7d086adcfd44e90af07e /source/blender/blenloader/intern/readfile.c | |
parent | d19bb6ffcf1364340cdb87b7bd6559ff90de8c0e (diff) |
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.
Diffstat (limited to 'source/blender/blenloader/intern/readfile.c')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 15 |
1 files changed, 13 insertions, 2 deletions
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; a<MAX_MTEX; a++) { + if(ma->mtex[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) { |