Blending two opacity masks in a certain way.

Hi, I need some help with some simple material math’s that I’m struggling to visualize before me.

I wish to merge two opacity masks, one is a simple 0 to 100% gradient, another is a textured mask.
My goal is to basically subtract the darks from the gradient to the mask, and add the lights, so that the mask blends in along the gradient, cutting off completely in one end and becoming 100% solid in the other, while retaining the texture in between. Like how landscape treats height masks while painting with a gradient brush.

Multiplying them together gets me halfway there, so that everything gradually goes white, but it does not remove the darker areas from the textured mask, so the white of the mask is still fully visible at the black end of the gradient. What else should I do?

Let me whip up some images to explain it better.
I have this mask:


And this mask:

And I need to merge them into a mask like this:

This is what Hard light does in photoshop.
The gradient is defined and applied at runtime, so I can’t just manually do it to a map ahead of time.

I know you have some blending nodes in the material editor, but these are a single channel, not 3vector.

Would an Append node work for 3vector textures to get combined, and then run an opacity mask that makes the white or black disappear?

Turns out the blend nodes support automatically converting the 1 channel inputs into vector 3, I then broke the 3 vector back into individual channel and used one of them.
This works for now, but I’m pretty sure I’m wasting a bit of processing here.

not sure what your problem is exactly.
what you are showing is the exact result of an Add operation plus a Clamp.

Take 1st mask, add second mask with lerp to black, 1st mask being alpha, then clamp.

Add isn’t enough and only gets me halfway there like multiply, it essentially results in this:

It didn’t cross my mind I could use the mask as the alpha instead of one of the targets! Since my goal was to have a combination of the masks, my mind was set on them being the targets.
This is the kind of stuff that I love about just asking around for a second set of eyes on something, it’s so easy to miss things that should be obvious.

The result looks great!

I would have gone with subtracting the 1-x fof the shade from the pattern before adding the regular version.
I’m not sure if the performance is better or worse then a lerp, but the result should be equally accurate.

Identical in all ways. A math instruction costs nothing alone, even in 16k.

Hi, I’m sorry I’m very interested about this cause I have the same problem. Could you please post a screenshot of the portion of the material editor?

To be perfectly honest, I couldn’t quite get the add methods to give me quite the results I was looking for, either being too sharp or not removing enough in one place, or too much in another and ended up using a blend soft light node and breaking out and using only one of the channels for the exact look and control I was going for instead.