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.
This commit is contained in:
Richard Antalik 2022-01-04 01:54:35 +01:00
parent 9c85acf61d
commit d2cc672b0c
Notes: blender-bot 2023-02-14 03:03:03 +01:00
Referenced by issue #75844, Blend modes are broken
1 changed files with 3 additions and 9 deletions

View File

@ -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 {