Now, I will warn you beforehand that this is probably a pretty stupid question, but I’ll assure, I have done my fair share off Googling and still can’t wrap my head around this.
I’m working on a menu for a game, and in this I want the game’s logo at the top. I have PNG/Targa-files with the only the logo and a transparent background and nothing else. Just for increased understanding, to illustrate, here is how it may look like in Photoshop:
Now I want to import it. Fine. Import the texture. It adds a white background. Meh. >:
Create a material out of it and the white background is still there. It shouldn’t. Why is it? How do I get rid of it? It can’t look like this:
Thanks for your answers! I tried what you said, darthviper, with a picture of a logo I got from our Art Director and it worked perfectly! But it did not work with the logo I had made in Photoshop, but I’m going to guess it’s because I hadn’t made an Alpha channel, like Gigantoad said, but that should be fairly easy, I guess! So thanks for your answers!
This only applies to Photoshop/Adobe apps:
The alpha in a .tga is treated simply as a fourth color channel (RGBA) PNG (from Photoshop at least) treats alpha as a premultiplied mask. That means that PNG files work well for very specific needs, such as UI elements that require a pre-multiplied alpha. TGAs allow much greater control over the actual alpha of an image, as well as the premultiplied color. This can ensure the artist is getting exactly what they intend. You can also use the explicit Alpha in a .tga as a fourth channel for effects that aren’t specifically alpha or opacity masking. Of course, if you’re not using Photoshop or are using some 3rd party plugins with PS, you can treat .png files exactly the same way as .tga files.
Also, while .png files are smaller than .tga files, they are slower to process (Opening and saving) as they have a very slow compression system. This isn’t a huge problem for most things, but a 4096x4096 .png is pretty slow. I’m probably biased as I deal with image sequences and the difference is night and day (However, I use .exr files for that now so that’s a WHOLE other ball of wax)
With all that said, .png files are certainly easier to learn with as they are more WYSIWYG from the photoshop viewport to UDK, but TGA files are used more ‘professionally’ because they are more explicit.
Googling around and this thread is the most relevant result I can find.
This needs to be fixed in UE as this behaviour is wrong. PNG has three colour channels and an alpha channel, therefore the colour in partially-transparent pixels must continue to be treated as absolute. Currently it appears that transparent pixels are treated as if the background is white. Transparent PSDs have the same issue.
It can be fixed in photoshop and imported as a PSD with an extra alpha channel, but it’s a lot of work.
The transparency of a PNG is not actually an alpha channel. That’s why using a different format with an alpha (like tga) can often be better since you can fill those pixels with the color you want to avoid fringes
Not quite right. That’s a misunderstanding of the difference between straight and pre-multiplied alpha. A PNG should never display a miscoloured fringe unless the fringe is in the colour data. It’s not a problem with the format as a PNG pixel is still just RGBA.