diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2014-01-23 21:38:48 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2014-01-23 21:49:10 +0400 |
commit | 9f903208e800d4580314dc03d31e8ae5fea73cdb (patch) | |
tree | ad84fc8ce83be760934732066f4d891c26521cf6 /source/blender/render/intern/include/texture.h | |
parent | b119f471f4c5bd20975091259a0da6ce155180e6 (diff) |
Fix T36165: blender internal HDR textures with negative values got clamped.
For example for vector displacement, you may have an EXR texture that has
negative colors values. Blender clamps these by default, now the Colors panel
for textures has a Clamp option to disable this clamping.
This option affects all texture types and is enabled by default, you need
to disable it if you want negative values to have an influence.
Patch by Fredrik Hansson with modifications by me.
Diffstat (limited to 'source/blender/render/intern/include/texture.h')
-rw-r--r-- | source/blender/render/intern/include/texture.h | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/source/blender/render/intern/include/texture.h b/source/blender/render/intern/include/texture.h index b23d6b09524..0e0337d6e0e 100644 --- a/source/blender/render/intern/include/texture.h +++ b/source/blender/render/intern/include/texture.h @@ -33,18 +33,22 @@ #ifndef __TEXTURE_H__ #define __TEXTURE_H__ -#define BRICONT \ - texres->tin= (texres->tin-0.5f) * tex->contrast+tex->bright-0.5f; \ - if (texres->tin < 0.0f) texres->tin= 0.0f; \ - else if (texres->tin > 1.0f) texres->tin= 1.0f; \ +#define BRICONT \ + texres->tin= (texres->tin-0.5f) * tex->contrast+tex->bright-0.5f; \ + if(!(tex->flag & TEX_NO_CLAMP)) { \ + if (texres->tin < 0.0f) texres->tin= 0.0f; \ + else if (texres->tin > 1.0f) texres->tin= 1.0f; \ + } \ #define BRICONTRGB \ texres->tr= tex->rfac*((texres->tr-0.5f)*tex->contrast+tex->bright-0.5f); \ - if (texres->tr<0.0f) texres->tr= 0.0f; \ texres->tg= tex->gfac*((texres->tg-0.5f)*tex->contrast+tex->bright-0.5f); \ - if (texres->tg<0.0f) texres->tg= 0.0f; \ texres->tb= tex->bfac*((texres->tb-0.5f)*tex->contrast+tex->bright-0.5f); \ - if (texres->tb<0.0f) texres->tb= 0.0f; \ + if(!(tex->flag & TEX_NO_CLAMP)) { \ + if (texres->tr < 0.0f) texres->tr= 0.0f; \ + if (texres->tg < 0.0f) texres->tg= 0.0f; \ + if (texres->tb < 0.0f) texres->tb= 0.0f; \ + } \ if (tex->saturation != 1.0f) { \ float _hsv[3]; \ rgb_to_hsv(texres->tr, texres->tg, texres->tb, \ |