Result of some blend modes was different in char and float implementation when using blend factor (applying transparency to src2 pixel). This was due to missing or wrong unpremultiplication in code. There were also inconsistencies in actual math, so I fixed those as well (I did my best at least).
Test file:
In included test package there are 3 test cases for each blend mode.
- Byte vs float with blend factor of 1
- Byte vs float with blend factor of 0.5
- Blender(byte) vs GIMP with blend factor of 1
In each test case you can see result of result of blend mode in one mode, than another mode and difference in 3 frames.
I should have made image with translucent shadow though. Will update next time.
References:
https://docs.gimp.org/en/gimp-concepts-layer-modes.html
https://www.w3.org/TR/compositing-1/
https://dev.w3.org/SVG/modules/compositing/master/
Remaining inconsistencies:
- Soft Light byte implementation gives a bit different result. Float is consitent with GIMP
- Add, Substract, Hue and Color are inconsistent with GIMP.
- Texture paint still gives inconsistent result between float and byte buffer blending I will have to dive a bit deeper into that code and find what is going on there.