Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Dietrich <kevin.dietrich@mailoo.org>2014-04-28 19:38:34 +0400
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2014-04-29 16:03:09 +0400
commit1dcf95684929806e80e3d0b514c8690cd757b1bd (patch)
tree2d5c4cc6a3c73996ec99e8f2c068dd92f3bc839a /source/blender/blenkernel/intern/material.c
parent4ff3ebf45c8b7fe6911fb40d43384dc04d7a132b (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/blenkernel/intern/material.c')
-rw-r--r--source/blender/blenkernel/intern/material.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index b0b9a4fa48d..c8ad920b2c3 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -1359,12 +1359,9 @@ void ramp_blend(int type, float r_col[3], const float fac, const float col[3])
r_col[2] = facm * (r_col[2]) + fac * fabsf(r_col[2] - col[2]);
break;
case MA_RAMP_DARK:
- tmp = col[0] + ((1 - col[0]) * facm);
- if (tmp < r_col[0]) r_col[0] = tmp;
- tmp = col[1] + ((1 - col[1]) * facm);
- if (tmp < r_col[1]) r_col[1] = tmp;
- tmp = col[2] + ((1 - col[2]) * facm);
- if (tmp < r_col[2]) r_col[2] = tmp;
+ r_col[0] = min_ff(r_col[0], col[0]) * fac + r_col[0] * facm;
+ r_col[1] = min_ff(r_col[1], col[1]) * fac + r_col[1] * facm;
+ r_col[2] = min_ff(r_col[2], col[2]) * fac + r_col[2] * facm;
break;
case MA_RAMP_LIGHT:
tmp = fac * col[0];