Diffusion Krita deb41edae4df

Additional Blending Mode - Softlight (Pegtop-Delphi) ,Phoenix, Penumbra…

Authored by dkazakov on Jun 25 2018, 7:28 AM.

Description

Additional Blending Mode - Softlight (Pegtop-Delphi) ,Phoenix, Penumbra Blending Modes series, Negation, Signed Difference, and Interpolate

Summary:
In this differentials, I have managed to create working blending modes, but they don't work 100% because Interpolate blending mode is another blending mode to be solved like Heat, and Freeze. Only this time, the issue is the reverse of them. In other words, Interpolate work just fine and dandy on float images, but they don't work on integer images, and it's easy to see why. cos(pi*1)=1, and cos(pi*0)=0.

The steps I did to create new blending mode

  • Study the blending modes using Pegtop-Delphi website
  • Categorize them carefully, and understand the blending modes.
  • When I look at the equation for the soft burn ,and soft dodge, I notice that they actually aren't burn and dodge because of their equation similarities. Because of their equation similarities, I have taken the liberty, and decided to call them Penumbra since they are the more appropriate name, and blend v. base shows a penumbra. Even with images, it's pretty clear that these blending modes all involves areas between light and darkness, and they even are better for painting shadows just due to their properties.
  • Then I start coding

For Softlight(Pegtop-Delphi), after many fails, I find the one in the code works pretty well and it actually compiles. A lot of the code involves the necessity of being able to compile, and other forms didn't work out for me. There might be normalization issues, but testing it, I see no difference. Even the Interpolate mode was made with compilation and end result in mind. The new negative modes are more for increasing compatibility with other applications in case the needs for those blending modes arise. The new softlight offers the benefit of preserving more details than other softlight, and therefore it increases usability of Krita.

Patch by Reptorian (Miguel Lopez)

Details

Committed
dkazakovJun 25 2018, 7:28 AM
Parents
R37:16bc5c48e7df: Fix PyKrita library search path for MacOS
Branches
Unknown
Tags
Unknown
Reptorian added a subscriber: Reptorian.EditedJul 15 2018, 6:26 PM

- Differentials

Hi, actually, I think I'm going to leave changes here. The file above is add a new blending mode which is a hybrid of Frect, and Helow. It most related blend mode is grain merge and interpolate, but hybrid of frect and helow shows more consistency on shading and highlight all-around. It's a slight better version of grain merge, but sometimes it is worse than interpolate, but it has the advantage of actually working on integer when compared with interpolate. I also fixed Helow issue.

Also, some quad modes are fixed because of my mistake.

Now it looks like this - https://i.imgur.com/UTreJPh.jpg without inversion being applied.


Also, I think I may create Contrast-Negate from Affinity Photo, and a smoother version of Contrast-Negate along with Distance Blend Mode. A smoother version of Contrast-Negate may actually be useful, but currently the one found in Affinity Photo/Designer has serious issues of discontinuity.

With those blending modes up and ready, Krita would be compatible with literally every single image editors/painting softwares and it is also future-proof in case changes come up.


Actually, I did found a working XOR blending mode theory after finding out that 75% Opacity does indeed lead to something that looks like XOR. The theory doesn't care if the image use is float or integer. But, I'm not sure where to leave that theory if someone wants to create XOR Blending Mode for Krita.

The uploaded file here shows that my theory does indeed works -

If you look at opacity, you'll note that it follows a curve based on the average of opacity of each iterations. Furthermore, you'll note that each iteration can be expressed in terms of conditions, and if value > x, then y where if value is between c, b. This is the indirect proof that XOR can work on float or integer. I'll leave this here if someone wants to take a crack at replicating the above. One other thing is that this works on float images between 0-1, so one would have to make the values positive, and for any values greater than 1 in float images would have to be subtracted by the nearest multiple of unitvalue to force it to be between 0-1.


Now, I have a experimental differential patch for XOR blending modes, and evidence that it certainly can be used for painting.

NOTE: XOR is incomplete, but the patch only works for 8-bit integer and is only for evaluation purpose. Nothing more.

If you look at these images, it shows that there's curvature, and XOR can be used for generate curvatures of fabrics (the main possible use for painting). I can tell where the shadows would go, and where the lighting would go, and how the end result may look like just by the curvatures of the curve found within XOR model. I can adjust lighting of different XOR'd layer, and I change the curvature, and then I can paint over the curvature reference or apply textures following curvature map.

Also, this is a example .kra -

If you modify the example .kra, and use light/dark brush, you can note how you can push curvatures. This makes it far more useful in some way than manually creating curvature, but it's a slow blending modes because of the needs to iterate to avoid the usage of bitwise functions as Krita will not work with bitwise functions. FloatXor is incomplete, but FloatXor, and the XOR iterations are indirect proof of concept that it's possible to get actual XOR with many iteration. Float form of XOR will never actually be the real thing, but enough iteration makes it indistinguishable in a way. The more iteration, the more closer it is to actual XOR. This excel document is indirect proof that XOR can be done -

What it shows that the more iteration, the better the xor result.

Other purposes of XOR is scientific imaging (i.e comparison), and generating 3D textures for rendering tests.


Some other purposes of XOR -

https://forums.getpaint.net/topic/3321-drawing-a-gemstone/

https://www.wikihow.com/Create-a-Blast-Effect-Using-Paint.Net

XOR makes a few thing easier to do. While those are possible without the use of XOR, and the end result are better without XOR, it still makes some things easier to do. XOR can also be used to split colors with text that are of one color. One other usage of XOR is that it can be used to generate interesting neon-like effect with the use of guassian blur adjustment layer.