Difference between Layer Subtract and Layer Multiply?

zigraphixzigraphix Posts: 2,787
edited December 1969 in Daz Studio Discussion

Does anyone know if there's really a difference between the Layer Subtract and Layer Multiply operations in Shader Mixer? I ran some comparison tests using colors and I'm really not seeing any difference between them. See the attached images, in which I multiply primary and secondary colors together, as image maps and as color values.

I thought Layer Subtract was calculated per channel something like this (treating 255 as 100% or 1):

Output = Base + (1 - Layer)*Alpha
(add inverse of layer, modified by alpha, to base)

And I thought Layer Multiply would be something like this:

Output = Base x Layer*Alpha
(multiply base by layer modified by alpha)

but the results I'm getting are the same either way.

What am I missing?

subVsMult.png
907 x 685 - 451K

Comments

  • BejaymacBejaymac Posts: 1,897
    edited December 1969

    What do you have the Alpha set to as what ever is in there determines what happens to Base & Layer, quick example, drop a mix brick into the SM, set it to color, leave Alpha at 0, but set Base & Layer to RGB 128,128,128 (medium gray), set it to Layer Subtract and hit the Preview button, you should have a medium gray ball.
    Why? because with the Alpha set to 0 the Layer has no effect on the outcome, set the Alpha to 0.5 and you should now have something close to RGB 64,64,64, as you have now subtracted half of the Layer's value from the Base. it's the same if you go the other way and set the Alpha to -0.5, you will now have something close to RGB 192,192,192 as you have added half the Layer's value.

  • zigraphixzigraphix Posts: 2,787
    edited December 1969

    I had a whole range of values for alpha. It turns out the problem was the base and layer. At full-strength channel values (e.g. 255,0,0 or 0,255,0) the results of multiply and subtract are the same, but with half values, e.g. 128,0,0 and 128,128,128, the differences are apparent.

  • Richard HaseltineRichard Haseltine Posts: 102,218
    edited December 1969

    I would expect subtract, per normalised channel, to yield

    (1 - alpha ) * base + alpha * ( base - layer)

    and multiply to yield

    (1 - alpha ) * base + alpha * ( base * layer)

Sign In or Register to comment.