diff options
author | Kevin Dietrich <kevin.dietrich@mailoo.org> | 2014-04-28 19:38:34 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2014-04-29 16:03:09 +0400 |
commit | 1dcf95684929806e80e3d0b514c8690cd757b1bd (patch) | |
tree | 2d5c4cc6a3c73996ec99e8f2c068dd92f3bc839a /source/blender/render | |
parent | 4ff3ebf45c8b7fe6911fb40d43384dc04d7a132b (diff) |
Fix for wrong behavior of 'darken' blend mode with factor.
The formula was not consistent across Blender and behaved strangely, now it is
a simple linear blend between color1 and min(color1, color2).
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D489
Diffstat (limited to 'source/blender/render')
-rw-r--r-- | source/blender/render/intern/source/render_texture.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c index 9c7c6738a11..3936305b22e 100644 --- a/source/blender/render/intern/source/render_texture.c +++ b/source/blender/render/intern/source/render_texture.c @@ -1420,12 +1420,9 @@ void texture_rgb_blend(float in[3], const float tex[3], const float out[3], floa fact*= facg; facm= 1.0f-fact; - col= tex[0]+((1-tex[0])*facm); - if (col < out[0]) in[0]= col; else in[0]= out[0]; - col= tex[1]+((1-tex[1])*facm); - if (col < out[1]) in[1]= col; else in[1]= out[1]; - col= tex[2]+((1-tex[2])*facm); - if (col < out[2]) in[2]= col; else in[2]= out[2]; + in[0] = min_ff(out[0], tex[0])*fact + out[0]*facm; + in[1] = min_ff(out[1], tex[1])*fact + out[1]*facm; + in[2] = min_ff(out[2], tex[2])*fact + out[2]*facm; break; case MTEX_LIGHT: @@ -1522,8 +1519,7 @@ float texture_value_blend(float tex, float out, float fact, float facg, int blen break; case MTEX_DARK: - col= fact*tex; - if (col < out) in= col; else in= out; + in = min_ff(out, tex)*fact + out*facm; break; case MTEX_LIGHT: |