Help painting material transparency as greyscale in Blender 2.8 (eevee)


(nul.painter.err) #1

I am trying to learn how to use a greyscale map to control a material’s transparency. For instance, black is fully opaque and white is fully transparent. I think I’ve mostly got it figured out, but I’ve hit a situation that I’m not sure is a bug, or a lack in my understanding.

Please see the attached blend file:
alphatest.blend (790.4 KB)

Here’s my main problem: I can “see” through the faces of the outer cube to the face of the inner cube, but the “blue” color carries through, even when they are colored 100% black. I suspect this may have to do with my shader setup.

Here’s what I want instead: I’d like the blue cube to look “solid” (that is, can’t see the inner cube at all) when the “alpha map” is 100% black.

Textual Description:

The scene contains two cubes, a blue one with an orange-ish one nested inside. The transparency map is attached to the blue one.

I am using a Principled BDSF mixed with a Transparent BDSF via mix shader. Material texture colors go into Principled BDSF, while “alpha map” colors are used as the mix factor. I thought I would need to use some kind of converter to use the colors as the mix factor , but the value of the greyscale seems to work how I want. Confirmation or refutation of this idea is appreciated…

I am using “Alpha Blend” for the Blend mode. I think this is what I want? It seems like Blend>Hashed>Clip in terms of “accuracy” (with a tradeoff of render time)? I’d also like to be corrected if this is wrong.


(icyou520) #2

I guess I am not understanding what you want.

When you say the “blue color carries through” what do you mean?

Everything seems to work as expected.

GIF


(nul.painter.err) #3

Thank you for taking a look!

The issue I have is that the inner cube is never fully hidden. When the transparency map is fully black, I’d like to not see the inner cube at all (in renders, anyways). It seems impossible for the material to be 100% opaque with this set up.


(icyou520) #4

The reason it is never fully opaque is because you drew white lines on your mask. So anywhere you have white lines it will be transparent.

Capture

bbbb

Perhaps if I knew exactly what you’re trying to accomplish I can find a better solution for you.


(nul.painter.err) #5

Ah, yes! Your example works as I’d like it to. In my model, the totally black areas are still somehow transparent (I can still see the inner box through them). So, if I recolor the “alpha texture” to fully black everywhere, I can still see the inner box. And it appears blue, not orange.

Here is an image where the “alpha texture” is fully black. I don’t know why I can still see the inner box, as I expect the outer one to be completely opaque.


(icyou520) #6

Get rid of that image texture, you dont need it then.

Only 3 Nodes are needed, Principled, Tranparent, and the mix shader.

What I am thinking is happening is your black is not completely 100% black so it has a very slight transparency.


(icyou520) #7

Oh also you have show backface on under your alpha blend setting. Uncheck that.


(nul.painter.err) #8

Thank you for your help!

My end goal is to have a greyscale map that can set the transparency of the surface that I can paint or texture freely, for a full range from 0-100 transparency. This is more of an attempt to develop a workflow than to get a specific render of these objects.

I made the texture fully black to show the specific issue:
the (seemingly) fully black regions are not wholly opaque

I think the black area is 100% black. I used hex color 0x000000 with the brush at 100% strength and pressure sensitivity off. Do you know of another way this can be happening?


(icyou520) #9


(nul.painter.err) #10

Brilliant - this was exactly the problem! It works 100% like I want now :grinning:

Thank you for your help. I’ll go learn what “backface” means now.