Author Topic: Add Sub Blending Mode: How exactly it works (if it works correctly)  (Read 2734 times)

Hi. I create two uniform colors connected to blend node, switched to Add Sub mode. I set the foreground  at Red=130, and background at Red=20.
According to Add Sub's description is Red=150 expected. In other words I expect a sum of FG and BG, because foreground is bigger, than 0.5. But I get Red=25.
Ok, I set red pixel of foreground to 100, and background to 101. The Add Sub's description says, in that case foreground must be substracted from background. 101-100=1 but I get 46! What is it 46? Where is it from? :-\

I understand that I understand nothing now. May someone to explain me a formula of Add Sub calculations?

AddSub remaps the foreground from the [0,255] range to the [-255,+255] range (mid gray is mapped to zero). Anything under 127.5 is a negative value. Anything above 127.5 is a positive value. 127 is remapped to a very slightly negative value (-1), and would only subtract from the background a little. 0 is remapped to the most negative value possible (-255), and would pull a white background down to black.

In your second case that gives :

(100-127.5)*2 = -55
101-55=46

Last Edit: August 20, 2018, 03:32:01 pm

I want to add that for the Tile Sampler / FX-Node, the Add-Sub blend mode is broken (and overrides to Add blend mode only)

More info here:

https://forum.allegorithmic.com/index.php/topic,17885.msg76769

Which is a shame, because with Add/Sub blend mode in the Tile Sampler you could do a lot of cool things.

I understand this can't be fixed because it would wreak havoc with backwards compatibility, but are there any plans to create a new Add/Sub blend mode that does actually work?

Well actually what's broken in that case is that Designer should not show Add-Sub as a possible blending option for color FxMaps (the Substance Engine does not support it). There is no plan to support that other than fixing the UI so that it does not show as an option, in part indeed because of compatibility issues with the sbsar file format.
If you absolutely need to do that, one possible work around is to replace your color FxMap with three separate greyscale FxMaps (one for each R G B channel) with AddSub blending modes, and remerge them after.
Last Edit: August 20, 2018, 05:12:16 pm

Thanks for your answer! It's really nice to have you be so active on the forum :)

I checked again, and it doesn't work for the Grayscale version of the Tile Sampler. Please see the attached SBS. None of the black areas in the input image are being substracted.

Or am I misunderstanding something?

I can get the effect that I want in a different way, but it would be nicer if things would just work as expected.






Hi,

The add/sub blending mode is slightly different in the Tile sampler than the one we are using in the Blend node.



In this example, I'm using the input from your graph.

While the background has a value of 128 :
- If the color value is lower than 128 : the pattern will be substracted
- If the color value is greater than 128 : the pattern will be added

By adding a color random, the pattern will have a chance to be added or subtracted.

Q.A Analyst

Ah right, I get it. So instead of the color of the pixels in the input image being blended with Add/Sub, it's the (single) random color that is applied to that instance of the pattern which controls if it's blended with Add or Substract. That's good to know :)

Thanks for the help!