Page MenuHome

Fix T75844: Blend modes are broken [WIP]
AbandonedPublic

Authored by Richard Antalik (ISS) on May 28 2020, 4:59 PM.

Details

Reviewers
None
Maniphest Tasks
T75844: Blend modes are broken
Summary

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.

Diff Detail

Repository
rB Blender
Branch
arcpatch-D7863 (branched from master)
Build Status
Buildable 9488
Build 9488: arc lint + arc unit

Event Timeline

Richard Antalik (ISS) requested review of this revision.May 28 2020, 4:59 PM

Was a bit confused about the title, is this two patches in one?

Was a bit confused about the title, is this two patches in one?

Ah this is very messed up. I was doing branches cleanup so I wanted to "save" work in progress. There are some unrelated changes as well as title

Richard Antalik (ISS) retitled this revision from Only produce warnings for selected movie or image strips to Fix T75844: Blend modes are broken [WIP].Jun 18 2020, 2:37 AM
Richard Antalik (ISS) edited the summary of this revision. (Show Details)
Richard Antalik (ISS) edited the summary of this revision. (Show Details)Aug 12 2020, 5:29 PM

Fixed in master already.