View Full Version : TGA vs. PNG Transparency in Maya
jedhunsaker
03-27-2009, 06:59 PM
If you want to know the difference between TGA and PNG when saving transparency, it's important to note the following:
PNGs use lossless compression, which uses significantly less disk space than the TGA format (about 23% in my quick test). TGA also has compression options, but they don't appear to be available within Photoshop and even if they were it wouldn't be as efficient as PNG compression.
PNGs saved from Adobe Photoshop with alpha transparency appear to have white artifacts around some of the edges when displayed in Maya (depending on vertex alpha and possibly other unknown variables). It seems to me that the reason for this is faulty programming on Adobe's part to conform to the PNG specification. To prove this is the case, I created a solid green layer with no background and saved as PNG. Still, the white artifacts were shown (see attached image). Note: Exporting a PNG from Pixelformer (http://www.qualibyte.com/pixelformer/) (free) seems to remedy this issue.
My experience with most software has been that they don't properly export PNGs (DAZ Studio and Corel PHOTO-PAINT come to mind). They always have halos around the edges, not related to the issue I've illustrated in Maya, but equally annoying. I haven't tested Fireworks, but as mentioned above, Pixelformer definitely saves them properly.
The problem with image formats is that they rely on programmers to successfully translate data according to the image specification. This goes for both importing and exporting image formats. Often, however, some programmers fail to adhere to every rule in the specification. This is more common with exporting than importing, as photo editing software isn't required to supply all features that an image format specification offers. This is why some software doesn't support PNG transparency at all and others do, even though they screw it up in the process!
In conclusion, I see no reason to use TGAs over PNGs unless you are: (1) forced to use Adobe Photoshop, (2) the game engine demands it, or (3) you have been instructed specifically to use TGAs. I am open to any arguments against this view.
Wikipedia: Truevision TGA (http://en.wikipedia.org/wiki/Truevision_TGA)
Wikipedia: Portable Network Graphics (http://en.wikipedia.org/wiki/Portable_Network_Graphics)
Note: The attached image reflects PNGs exported from Adobe Photoshop.
way to go get the answer when I can't give you one.
well done.
rburke
03-28-2009, 08:38 AM
good stuff to know but quick question. Are you using any vertex alpha. We are having to uses png for our engine, but have encountered problems with the combo of vertex alpha or color and pngs. Also check some of the filtering options in mayas hardware shading options and also somewhere else in maya. The textures are automatically filtered by maya which could cause such artifacts.
jedhunsaker
04-02-2009, 02:15 AM
Are you using any vertex alpha.
Before I say anything, you need to know that I figured out a fix to all of this and have edited the original post to reflect this information.
That said, no, I'm not directly using vertex alpha on this simple shape; however, there is definitely some vertex color being used on other objects in the scene (some possible alpha too). To remove this variable from the mix I created a brand new scene and, sure enough, the problem went away!
But don't tune out just yet!
I have more evidence to prove that Adobe is the culprit here for the original problem of these white artifacts, which have presented themselves in both versions CS3 and CS4.
I just downloaded and installed Pixelformer (http://www.qualibyte.com/pixelformer/), which is a free, extremely small installation (2.7 MB) that can export the PNG accurately in the first place! You can also import a TGA and save it as a PNG without any alteration and get a flawless PNG as well.
Regardless of vertex alpha or whatever else was causing my problem, a simple PNG export from Pixelformer solved all my problems. The cool thing is that the installation is so freakin' small you can install it on your flash drive!
Another bonus is that the file size of the exported PNG from Pixelformer is also smaller than Adobe's version. It's only 6.49 KB. Now compare THAT to the 32 KB TGA above.
In conclusion, my faith in PNGs has been restored. I'm beginning to think there are many misconceptions about PNGs because most people export them with flaws from Adobe Photoshop. Considering the benefits of PNGs over TGAs I really see no reason whatsoever to use TGAs unless the game engine demands it. Lossless compression – it's a no-brainer. Use Pixelformer!
Systous
04-04-2009, 08:35 PM
I can add only this... PNG seemed to come about with the introduction of the Macromedia suite.
Flash, Fireworks, Dreamweaver.
Being previously employeed to use these tools, I know solely use Fireworks, it's native format is layered PNG. The PNG files start with a default alpha transparency and cause me some confusion at first wondering why things were suddenly transparent.
Personally I use PNG for the reasons previously mention, Lossless compression, alpha trans, layering. If you are getting artificats in Photoshop I'm inclined to agree, as previous to the Adobe consuming the macromedia suite, Photoshop did not have PNG support. On the contrary I've heard TGA from several staffers/teachers citing use in texturing, and the Playblast render engine (then importing into Affect Effects as sequenced TGA, something not available for the PNG format.)
Just one more reason to have 5 monitors and 16gbs of ram.
2 cents.
-S
jedhunsaker
04-05-2009, 12:45 AM
PNG seemed to come about with the introduction of the Macromedia suite.
Flash, Fireworks, Dreamweaver.
Actually, I've been in web development for 15 years and I knew this sounded way off. I remember playing with PNGs long before Adobe acquired Macromedia. In fact, PNGs popularity starting gaining momentum after the W3C Recommendation on 1st October, 1996 (press release (http://www.w3.org/Press/PNG-PR.en.html)), long before the acquisition of the Macromedia suite on 5th December, 2005 (press release (http://www.adobe.com/aboutadobe/pressroom/pressreleases/pdfs/200512/120505AdobeAcquiresMacromedia.pdf)).
And to quote an article here (http://morris-photographics.com/photoshop/articles/png-format.html):
While Photoshop has supported the PNG format since version four (1997), it wasn't until version seven (2002) that the majority of its PNG-related issues were finally resolved. Nevertheless, its level of support is still not what one might expect given its price tag.
I've been trying to say this for years that Photoshop lacks what one would expect in terms of support for the price tag.
The same article states that many of the issues with Photoshop's PNG support can be resolved by using SuperPNG (http://www.fnordware.com/superpng/), a freeware plug-in by Brendan Bolles. I have yet to test this plug-in (let me know what anyone finds out).
I just hope Photoshop gets up to speed with the demands of its market, but I'm not holding my breath because it's been well over 10 years since PNG's inception into Photoshop and I don't want to suffocate. Yeah... my bias comes out... I'm an Adobe hater (Dabu knows it). You can imagine how upset I was to hear Adobe was buying Macromedia. I loved that company!
Bias aside, I have to straight-up dis a company I very much love, Corel, for doing a much worse job with respect to PNG support. Even today, PNG support is an epic failure within Corel PHOTO-PAINT. Shame on you, Corel! Shame on you!
If only both companies would spend more time and money fixing their product instead of coming out with new features.
What were we talking about again...?
jedhunsaker
04-05-2009, 12:53 AM
way to go get the answer when I can't give you one.
well done.
Thanks Dabu. Don't sweat it! I appreciate not giving an answer when you don't know it. I have respect for that because far too many teachers make sh*t up sometimes to cover their tracks. I don't expect even teachers to know everything. I just want to learn accurate information from them. Props to you, Dabu.
rburke
04-06-2009, 08:59 AM
While PNG is a good file format i dont think its used regularly outside of the world of web based graphics. It seems to me that the more common formats for working in realtime stuff are tga while in production, and then dds when in engine. The dds format is really great and offers many options for any type of file you would want to save, you have complete control of what channels to have compressed, or merged, or excluded. Maya now comes with plugins for dds reading, and nvidia has the plugins for photoshop. Also many times people overlook that you can save into a maya IFF directly in photoshop, and they work very well with maya.
Thank you for the links to the PNG plug ins and converters, our class will be putting those to use on our current project. ANd yeah your right PNG has been around since about 1996 it was based on GIF - image sequencing + Alpha.
oh yeah, another advantage of png over TGA that has not been mentioned is that you can preview them in windows, instead of just seeing icons. And that is super useful.
rburke
04-06-2009, 09:20 AM
okay update to my previous statement i forgot about these plugins, these let you preview Targa files within explorer and also there is one on that page to preview maya iff files in explorer. Very nice feature to have.
http://greggman.com/pages/thumbplug_tga.htm
jedhunsaker
04-06-2009, 08:10 PM
okay update to my previous statement i forgot about these plugins, these let you preview Targa files within explorer and also there is one on that page to preview maya iff files in explorer. Very nice feature to have.
http://greggman.com/pages/thumbplug_tga.htm
This is a really good tip! Thank you!