Black on an alpha map

Well…this used to be simple, but having a problem with doing it in Cycles. Anything black on an alpha map doesn’t seem to work for me. I have a transparent image with black text, and I finally was able to get it to show up, but I can only get it to show up any color but black. Any suggestions? I am also using it has a bump map, and the bump map looks like it’s working fine. I have tried .tiff, .jpg and .png. Here are my nodes:

If you don’t want to use the colors of a texture, well, don’t plug it anywhere! :smiley:

In your case, unplug the noodle which goes into the color socket of the Diffuse node so that only the alpha channel is used as factor. Then you can set any color you want in the Diffuse node.

A little tip: You really want to plug some texture coordinates into the Vector socket of the Texture node used for the displacement. Even better, just pull a noodle directly in between the first Texture node and the Color Mix node. One less node will make your win a few ms at rendering time. :wink:

If I’m not mistaken there’s another issue too. You are trying to use the alpha of a jpeg as a mix factor. That will work with pngs, which have an alpha channel, but not with jpegs. You can use the grayscale color of a jpeg as a mix factor but you’d need to plug it into the color output of the leftmost jpeg. Either that or change it to a png. If that makes sense.

Thanks…this is closer. The letters/numbers are actually stamped on there anyway, so they would not be black like I originally thought. However…this still doesn’t solve the problem of how to make them come out black. I suppose I could just make the texture background image the same color as the shell and that would solve it…but I’m sure there will come a time when I need to use something black on a transparent background…and nobody seems to know how to do that with Cycles yet.

As I mentioned, I’ve tried with .jpg, .tiff and .png. Actually, how Kaluura has it above, the image doesn’t even matter. I “x’d” out the image and I get the same result as my second screenshot.

Just plug a diffuse black into the mixed shader top input. You need two inputs. And use the color output of th jpeg – not the alpha – as the factor. Using the alpha of a jpeg is meaningless.

That worked, thanks, but without the diffuse black part of it. If I put the black diffuse in there it doesn’t change anything. I guess what this means is in Cycles, you need to use a jpeg as a mask instead of trying to use an alpha image like a .tiff or .png. The nodes aren’t intuitive to me at all, but it’s a learning process.

After having googled some bullet images, I think that I understood what you’re trying to do.

Correct me if I’m wrong. You have an image of the writings at the bottom of the bullet where the writings are black on transparent and you want to carve them into the bullet.

Here is the tree that I build for that.

Note however that the color of the writings is irrelevant. I use only the alpha channel as factor of the Color Mix node to “re-build” the bump map. And the result…

I made some variations with the same image. I guess you’ll find something that will interest you in my file.

Forum Stamped.blend (157 KB)

(If you see no bump map, unpack the texture from the UV/Image Editor. But that shouldn’t happen if your version of Blender isn’t too old.)

Well it sounds like you got it working, although you can definitely do it with png transparency. My gut instinct is that you don’t really have transparency in that png, but rather a solid background. Impossible to know without seeing the image in photoshop. I had a real tough time making my first corona bottle using png tranparency, but thanks to Kaluura and a couple others I got it sorted out and wrapped my mind around the alpha noodles. Good luck with your bullets.

Correct. I have no problem with the bump map, but had some issues getting the black to show up using the transparent texture. But looking at your file, I think I understand now - you are using the alpha transparency, but throwing a color mixer in there first to control the value of the color - using diffuse and glossy to get it to be viewable and then plugging in the bump map like normal. Then with the color mixer you can put it to whatever color you want - including black! Excellent, thanks for you help! With every step, I’m getting closer to wrapping my head around these nodes. :slight_smile:

I’m glad that you understood it this way. Now, the thing to remember for the future: The Color Mix node on the noodle towards the Displacement socket is in fact useless.

Fully transparent has the value of 0 in the alpha channel and fully opaque is 1… which are also the values, respectively, of black and white once converted into values for the displacement (or as a factor). So, if you remove the Color Mix node with [CTRL X], you’ll see no difference in the final render. Pure Blender magic! :wink: