1
$\begingroup$

I made a png file in Photoshop that only has R/G/B/A channel like this:

enter image description here

Then I'm going to use this as my texture in Blender in shader editor:

enter image description here

The final result is like this all black, where the text should've been in the red area,because I only unwrapped the center face

enter image description here

enter image description here

Why is mesh all black, even the left corner dots that represents all the rest faces, are black, the area in the texture is transparent, did blender treat transparent area as Black? The Png image doesn't have Alpha channel, only R/G/B, can some one help me to understand。

Edit:This is my original image,with only R/G/B channel, no Alpha channel, you can check how it looks in Photoshop from above checkerboard screen shot, the background is transparent, though no Alpha channel, no 4Th channel, it 's transparent and I suppose the RGB for the transparent is NULL, I'm not sure if transparent pixel can be R:null,G:null,B:null, if you know what I mean, it is common to control by using Alpha channel, but Photoshop can save transparent as NO RGB VALUE

enter image description here

$\endgroup$
1
3
$\begingroup$

Let's start with the very basics.

What you call "transparent" is an Alpha Channel at work.

The image you are creating has tree color channels (RGB) and a separate Alpha channel, that is used as a Mask to determine how the image is combined with others.

enter image description here

This is what the Alpha Channel looks like:

enter image description here

The alpha channel is nothing magic, it is just black and white image where the opacity is set by the white element (a value of $1$) and "transparency" by the black (a value of $0$), any gray elements would be "semi-transparent".

In blender RGB information and Alpha channels are accessed separately, in other words, you must plug the Alpha channel to something to determine what gets the RGB information and what doesn't.

The most basic setup is like this.

enter image description here

The color of the shader is provided by a mix RGB node, that is using the RGB info from the texture (color) and the alpha channel separately, as factor for the mix with a yellow color.

The alpha channel is used to determine what parts of the texture get what color. What is black on the alpha channel will be yellow, what is white in the alpha channel will have the color (RGB) information of the image texture used.

Or you can use the alpha channel to mix different shaders:

enter image description here


UV mapping.

By default blender creates a UV map when you create a cube, so there is a UV map already present in all of the other faces.

enter image description here

The simplest way to deal with would be creating a new material and assign it to that face, but if you want to keep using a single material for the whole thing, you can edit the UV map so that all of the other faces' UV map out is of the picture, and make sure that the extrapolation for the texture used in the material is set to clip, that way anything out of the 0-1 UV space will be ignored.

enter image description here

If the image contains an alpha channel usually blender will pick it up, but in case it doesn't you can enable it manually.

enter image description here

$\endgroup$
5
  • $\begingroup$ What I see in image editor is it contains r:black g:black b:black alpha: black+ white, while in photoshop it is r/g/b:all transparent background + black text, I am wondering what blender has done behind the scene to add adtional alpha channel and made the rgb channel totally different. Because in photoshop it still with no alpha channel $\endgroup$ Jan 29 '21 at 0:07
  • $\begingroup$ I dragged the texture directly to shader editor and nothing else, so it is blender did something to make the texture different $\endgroup$ Jan 29 '21 at 0:11
  • $\begingroup$ There is no such thing as transparent. It is alpha channel ALWAYS. Saving the alpha channel as part of the image depends on the format. Some formats can store alpha channels, some don't. Use an image format that does, and make sure that the app you are using to create the file stores the alpha channel as part of the image. It is possible also that when you imported the image into blender, you did not activate the alpha channel. See edited answer. $\endgroup$
    – susu
    Jan 29 '21 at 0:18
  • $\begingroup$ Read also: blender.stackexchange.com/questions/27633/… $\endgroup$
    – susu
    Jan 29 '21 at 0:19
  • $\begingroup$ From the information provided I can narrow down where this problem is: the photoshop png file I created does not have alpha but when it is in blender, it does, I will have to find why blender auto created an alpha channel and inverted the rgb color for me $\endgroup$ Jan 29 '21 at 2:55
1
$\begingroup$

First, you need to do something with the alpha output of your texture. For example, plug it into the alpha input of your shader. (BTW: it seems that your PNG does contain an alpha channel...)

Then, if you use EEVEE, you need to make sure that your material's blend mode is set to "alpha hashed" or "alpha blend". (See here: https://docs.blender.org/manual/en/2.90/render/eevee/materials/settings.html#blend-mode)

If your image doesn't have an alpha channel, you need to tell the shader somehow what is transparent (alpha=0 / black) and what is opaque (alpha =1 / white). You can use the color data from your image to do so, although you might need to invert it in your case.

$\endgroup$
10
  • $\begingroup$ I do not understand, because the non-text area is transparent, I already told Blender it has no color, why should I tell Blender again, when this photo is edited in Photoshop, this non-text area is empty, has no R/G/B value which is null, then what blender will treat the null value as black? $\endgroup$ Jan 28 '21 at 14:41
  • $\begingroup$ Sorry for being a bit unclear. The problem is that while blender "knows" about the alpha channel of the image, you do not tell it what to do with it. That's what the "alpha"-ports both on your texture node (output) and your shader node (input) are for. Without a connection between those two, blender just passes the color information from the texture to the shader and ignores any transparency. As an alternative (i.e. if your image does not have an alpha channel), you can feed the alpha-port of the shader with an image texture itself. Then, black pixels will be transparent, white ones opaque. $\endgroup$ Jan 28 '21 at 15:26
  • $\begingroup$ By passing the color information to the shader node is enough, because the text is black, but the problem is why the background is black as well, so I can not see the text itself $\endgroup$ Jan 28 '21 at 15:37
  • $\begingroup$ This simply depends on what background color you had set in Photoshop and in this case I assume that it was black. As Alpha/Transparency is treated almost like a fourth color component, you can have black transparent, white transparent or anything in between without ever seeing the difference, unless you ignore the alpha channel. Could you upload the original image to check properly? $\endgroup$ Jan 28 '21 at 15:42
  • $\begingroup$ Hi I uploaded another image, hope you understand what I'm confused about-the transparent area, really hard to understand if it is NULL value $\endgroup$ Jan 28 '21 at 16:04

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