[Bf-blender-cvs] [d2cc672b0c1] master: Fix soft light blend mode math
Richard Antalik
noreply at git.blender.org
Tue Jan 4 02:11:58 CET 2022
Commit: d2cc672b0c12287b4602e1c26fd9d75010df9558
Author: Richard Antalik
Date: Tue Jan 4 01:54:35 2022 +0100
Branches: master
https://developer.blender.org/rBd2cc672b0c12287b4602e1c26fd9d75010df9558
Fix soft light blend mode math
Function `blend_color_softlight_float` used math different to compositor and
produced result that had abrupt value changes.
Use math based on modified screen blend mode as compositor does.
===================================================================
M source/blender/blenlib/intern/math_color_blend_inline.c
===================================================================
diff --git a/source/blender/blenlib/intern/math_color_blend_inline.c b/source/blender/blenlib/intern/math_color_blend_inline.c
index a19537bca0f..73ecb2cf798 100644
--- a/source/blender/blenlib/intern/math_color_blend_inline.c
+++ b/source/blender/blenlib/intern/math_color_blend_inline.c
@@ -896,15 +896,9 @@ MINLINE void blend_color_softlight_float(float dst[4], const float src1[4], cons
int i = 3;
while (i--) {
- float temp;
-
- if (src1[i] < 0.5f) {
- temp = (src2[i] + 0.5f) * src1[i];
- }
- else {
- temp = 1.0f - ((1.0f - (src2[i] + 0.5f)) * (1.0f - src1[i]));
- }
- dst[i] = (temp * fac + src1[i] * mfac);
+ float screen = 1.0f - (1.0f - src1[i]) * (1.0f - src2[i]);
+ float soft_light = ((1.0f - src1[i]) * src2[i] + screen) * src1[i];
+ dst[i] = src1[i] * mfac + soft_light * fac;
}
}
else {
More information about the Bf-blender-cvs
mailing list