Hi there,
I’ve been playing with cutout shaders and additive and multiply shaders a lot recently, and just wondered if the following is possible / makes sense.
To my understanding, additive literally adds the color of the pixel to whatever it is over, multiply similarly “multiplies”.
With multiply, a coloured pixel multiplied by black will equal black, and multiplied by white will equal itself, right?
My question is, what happens if a pixel is multiplied by a pixel that is rgba of (0,0,0,0) e.g. transparent black? Is it possible using a multiply shader, and a carefully prepared texture (say, with a white shape, cut out of a black+transparent background), to act like a mask? A normal multiply shader would show black for the outline, and the original shape for what’s inside. It feels to me (And at the moment, my shader knowledge is entirely based on intuition), that it should be possible to alter the multiply shader to work a bit more like “alpha blended” particle shader. Is this actually possible?
In other experiments, I’ve had some limited success with a cutout + multiply shader, with two texture slots, one of the texture, and one with an appropriate setup mask texture. By performing the multiplication between the textures in the shader, I’ve been able to “mask” the texture, but would love to know if it is in theory possible to extend this technique into a more general masking technique.
Note I am familiar with depth mask masking, but would like to see if there’s a “clever arithmetic” way of blending that would perform a similar trick.
(I’ve also imagined maybe a plane with a texture, obscured by another plane with the same texture and a mask texture, performing some sort of “subtractive” or “inverse” to perform masking.
Basically, I need as many masking tricks as I can gather at this point, since having to create multiple cameras per depthmask layer makes it a little awkward as a general masking solution fit for an average project.
Thanks in advance!
Mike