- Home /
My .PNG gets solidified and an alpha channel. How?!
I have an imported .png in my project, and it looks like Unity is doing something to it so that it gets solidified and an alpha channel. It works great, but I haven't been able to reproduce the effect.
This is the png (with watermark).
This is the png in Unity's Inspector, I stuck in it's alpha channel as well.
Can anyone clue me in on what setting is creating the edge bleed and alpha channel?
Photoshop is irrelevant here. It's about Unity converting to PNG to DXT. This needs an answer from someone technical who knows how unity converts to pngs to DXT5.
Answer by Owen-Reynolds · Apr 24, 2013 at 04:55 AM
That's just the way Unity choses to display it -- as an RGB. There probably isn't any edge bleed. More likely the artist just brushed that big green streak on the left that exact way. But, it's always hidden by the alpha, so who cares. It's really more of a bug in gimp/photoshop that you can't turn off alpha-checkerboard magic to see the raw channels.
In a game engine, the alpha channel is often not transparency, so it doesn't make as much sense to always show it that way. For example, a spec shader assumes alpha holds the spec map. You want to see the raw RGB colors for that.
The tricky thing is, how it appears in the Inspector is not how the artist painted it. He painted it exactly how it appears in the first image. When I look at the png in Photoshop, it does not have an alpha channel just transparency, which to my understanding is how png's work. They don't have an actual alpha channel just transparency info stored in the file.
I get that the DXT5 png compression gives the file an alpha channel to store the transparency info, but how did Unity solidify the RGB as well? I'd like to know, because thanks to that edge bleed, my assets don't get that white halo around the edges.
Transparency is always stored in an alpha channel. What do you think is transparency? It's just an additional information for each pixel how solid it should be displayed. Each color channel just has a color value, even at pixels that have an alpha value of "0". It's all just data. It's like your harddrive is never "empty". It's always full. The areas that aren't used at the moment may contain random data or what ever was stored previously there.
Here it's the same. Just because the alpha channel has a value of 0 that doesn't mean the color information for those pixels doesn't exist. That's actually not possible.
Look at the big envelope and the red button beneath it. The artist used one vertical swipe to paint both red, since she knew the middle part was hidden by transparency.
That cut-off white rectangle just above the big envelope was part of some other image where the artist had white envelope lines. She just grabbed a bigger chunk than she needed, pasted onto a higher layer and merged down -- knowing that little rectangle part would be hidden again by transparency.
You can think of the alpha channel as masking tape. Once you have it down, you no longer need to waste time staying within the lines.
First of all, thank you for the replies!
Owen, I want to reiterate that the artist did not create the edge bleeding that you described, the top image is exactly how the png looks in the Finder/Explorer. Something happens to it in Unity that creates the effect.
Bunny & Owen, from what I've read, pngs do NOT support alpha channels. Check out these links I've found that can explain it much better than I could:
http://forums.adobe.com/message/3021759 http://forums.adobe.com/thread/796354.
Unity is taking the png and creating an alpha channel after applying a DXT5 compression. So it's taking the transparency info to create the alpha channel, but that still doesn't explain the edge bleeding.
Photoshop doesn't like to use the technical term alpha. Ins$$anonymous$$d they call it the Transparency channel. That's what those posts are saying: photoshop transparency maps onto graphics card Alpha (the A in RBGA.)
Further, they are saying that photoshop has something different that it calls alpha, which is only used to manage internal photoshop stuff. If you set photoshop "alpha" then a png save won't give you real RGB-Alpha.
But, is your real problem you think that Unity broke it? $$anonymous$$ake a material using that texture and select Transparent->Diffuse for the shader. Put it on a plane. You'll see that it's fine. That setting puts that black/white alpha as a mask on the RGB, to get what you see in photoshop.
Your answer
![](https://koobas.hobune.stream/wayback/20220613100905im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to use the alpha channel of bump map, as transparency. 2 Answers
Add Alpha Support for Fog Shader 1 Answer
Transparency not working in Windows build 3 Answers
Does Unity premultiply alpha in imported PNGs? 0 Answers
How to fade out over time? 1 Answer