Alpha texture with png transparency hack in cycles

I’m trying to model a corona bottle, and I’ve finally run in a wall with alpha textures. I successfully did use the alpha output of the image in the nodes into a mixed shader with transparency, and I can get rid of the alpha channel from the render. The problem is that I can’t get my material (glass) to render now. If I change the transparency color to red it renders correctly with the image and everything, but when I set it to white the material disappears. I have included my screenshots of nodes and renders. Any thoughts greatly appreciated. Thank you.

I never thought it world come to this, but I am very seriously considering switching to Heineken. Sadly I am not kidding.

I think you need to add another mix shader coupled with a transparent shader and a glossy shader. I would use the first couple as you did with the white in the transparency just as the label itself, then with another mix shader , add a second set with a mix of transparent and glossy.

Glass is not a transparent shader. You need another material for the glass itself and another mix node.

Thank you all for your responses. I’m getting closer but still not there yet. Here’s my latest attempts. It shouldn’t be too much longer now.

I finally got it working. Although I highly doubt I’m doing it the “right” way. I think the render looks pretty convincing, with a little more tweaking and photoshop work I think I’ll really have it. Anyway, here’s how I achieved the effect in cycles:

I don’t know what you’re doing but it’s very simple… and the color of the decal is irrelevant. Just to prove it, I inverted my black biohazard symbol and overlaid it on a hollow cube of default glass.

As you can see, the node tree is very simple. No?

but in this case where is the white coming from is it the pic itself or the diffuse node may be

the glass is white so it is transparent

sorry i find it confusing crazy when you take into consideration the alpha with a PNG!
depending if the white color is going to color or fac input !


Your too hung up on the alpha value of the image. You can get the same effect with a .jpg flattened to b/w
Like this. B/w biohazzard image used…

even more confusing
sometimes you can do it with simple jpg or need to use a PNG or EXR with alpha
with jpg it looks like white will be transform into transparent in the render!

what is the logic behind it !


Guys, you aren’t using examples that contain the same difficulty - use an example that has the same black and white elements in the label and try the use of the black/white as alpha, then what happens…

Dude, where were you like 10 hours ago? That is the correct way to do it for sure. You can just disregard the whole masking insanity and use Kaluura’s nodes. Of course now that I see it, it seems painfully obvious, but such is life learning to model. Thanks to everyone who helped.

Think of the white as being a value of 0 and black being a value of 100.
I you plug a b/w image into the fac of any node,the black area will let whats in one slot through in that shape, and white will allow whats in the other input through in its shape.

i know it is not that simple
so many variables to be taken into consideration

ok but when you take color from image BW or color to the FAC input
how does the FAC input transform this vector RGB values info a FAC single input
is there sort of an algo to re calculate the Y value from the RGB vector values?

and if it happens to be white then then it is 0 or black =1 !
and if it is jpg then there is no alpha value which is an independant value anyway
but this alpha value can be on any colors part of an image

if you use a shader node like glass or transp you can also set the color with an alpha value with color swab

i mean there are several variables top play with here!


A mask needs to be created…
Mask is the fac

just to remind things
true for cycles ior blender
by definition mask is a white and black image
no alpha here !


The mask determines what is covered by the alpha. Black-yes-white-no.
Take the mask in real life and cut out the black and then hold it to the light. What was black will let the light through, but the white parts will not allow light through. Same principle with using masks to determine what makes it through a particular node.

Rich, those parts of your image that are yellow, they aren’t really yellow, they’re transparent with beer behind them.

Alpha just acts as transparent because of how programs display an image. Black and white are only black and white because of how the values are translated by a program when viewing an image.
Blender just uses the pure values. Each of the three colours and the alpha for each pixel are just four values, which can be anywhere from 0 to 255 (depending on bitrate, 256 is 8 bit per channel). So if you have an image with no mask, just a grayscale channel, you have the same, any value from 0 to 255. How you use them in Blender is up to you. Output to R, G and B? You get a black and white image. Output to Alpha? You get an alpha mask.

Yes, the white color of the decal comes from the image itself. It could be red, green or blue, it’s irrelevant. (Don’t force me to do a rainbow biohazard symbol!) :wink:

And no, the glass isn’t transparent because it’s white. (Actually, it is light grey.) It’s transparent because that’s how the glass material is in Blender. You can have glass of different colors, like in the real world.

As for the alpha channel, it’s really not complicate when you see it as a second image in your file which tells to the software using it “Here, draw the image, there, draw the background, etc”. The color of the image itself is of no consequence. In other words, the alpha channel is a mask. If you edit an image with an alpha channel (PNG, TGA, TIFF, etc) in the GiMP, for example, you can really edit the alpha channel as if it were a simple (greyscale) image. It’s black and white but contrarily to what you think, white in the alpha channel means full opaque. This is also so throughout Blender… Except in one place, just to mess with your head: The Transparent shader consider white as fully transparent. (To be honest, the Transparent shader doesn’t make much sense to me.)

I hope it clears things out.