Fix blend_color_interpolate_byte returning wrong alpha in certain case

When the combined alpha [the 'tmp' variable having the mixfactor applied
already] - reached zero it was handled like a no-op (for the alpha as
well) and just copied the first color.

So e.g mixing 255/255/255/255 with 0/0/0/0 with a factor of 1.0 gave
alpha of 255, which looks wrong.

cases where tmp gets zero:
src1 alpha:0 src2 alpha:whatever mixfactor 0.0
src1 alpha:whatever src2 alpha:0 mixfactor 1.0
src1 alpha:0 src2 alpha:0 mixfactor whatever

Now set alpha to zero in that case.

ref T81914

Maniphest Tasks: T81914

Differential Revision: https://developer.blender.org/D9357
This commit is contained in:
Philipp Oeser 2020-10-27 13:20:50 +01:00
parent 01d02e78b5
commit 6a5d2f4ea2
Notes: blender-bot 2023-02-14 09:48:23 +01:00
Referenced by issue #81914, Data Transfer modifier works inconsistently when dealing with Vertex Color Alpha
1 changed files with 1 additions and 0 deletions

View File

@ -606,6 +606,7 @@ MINLINE void blend_color_interpolate_byte(uchar dst[4],
}
else {
copy_v4_v4_uchar(dst, src1);
dst[3] = 0;
}
}