1
$\begingroup$

So I've been trying to stack two textures with alpha on top of each other and while I can remove the Alpha on each with enabling alpha blend the problem is the textures bleed into them.

From what I gather it has to do with the FAC value the alpha is plugged in or set manually, which might be expected from a mix note...

While I followed How to stack/layer two textures with alpha over each other with Material nodes? down to a t (other than the texture mapping), I tried other methods and end up still with a mix of the two textures than them being properly stacked. Maybe someone can help.

Nodes & Shader view

$\endgroup$
2
4
$\begingroup$

For Eevee, you might have to go the extra mile of creating 2 shaders and mix them together instead of doing it just for the textures. See here:

enter image description here

$\endgroup$
1
  • $\begingroup$ Thanks, this helped a lot, especially, but not limited too, seeing which alpha should be used in the last mix shader FAC value! $\endgroup$
    – Kiwamu
    Jan 5 '20 at 16:18
3
$\begingroup$

Here's an example of combining B over A (both images have alpha channels)

To mix the RGB (color) information use the alpha info of B to control the color mix (this would be the proper Alpha Over operation)

To combine the alpha channels use a color mix node and the Add operation mode. Then plug the result to the alpha of the material node.

enter image description here

$\endgroup$
1
  • $\begingroup$ This is still blending A & B what I am trying to avoid, but I still find this valueable and thank you for your thread contribution! Indeed I even looked into your thread Overlay more than one transparent images in one shader earlier. The more I look at your and the selected answer node, the more I think I chose the WRONG Alpha to put into the last shader FAC. $\endgroup$
    – Kiwamu
    Jan 5 '20 at 16:23
0
$\begingroup$

I got a same issue and found this question. The answer above works but a bit mess with many nodes, so I came out with a simpler solution.

In the following example, having the mouth texture as the base, the eyes texture is put on top of it.

Such overlay is done by Principled BSDF shader. Subsurface Color comes on top of Base Color, while applying alpha to the subsurface from Subsurface.

On the other hand, we need alpha data which makes it transparent in the area where both textures are transparent. It can be simply mathematically calculated. Create two Math node, which you can find under Converter category. Then, have one of those as Add to add the two Alphas of the textures.

At this point, the alpha data has some alpha value at the overlapping part of the two textures, which causes such area looks lighter color on the view. So, let's remove it by using the other Math node. Having it as Multiply with Clamp option, multiply the previously added alpha data with value 1.0. Now, you can use it for Alpha of the Principled BSDF shader.

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.