PNG vs BMP.. Too SLOW!!

Started by
13 comments, last by superpig 16 years, 4 months ago
Quick question along the same lines as the OP.

I'm using XNA currently. Because the content pipeline compiles my graphics data to its own format at build time (XNB format I believe), does it matter at all what type of image I use for texture data, since it's gonna be converted anyway?
Advertisement
Photo Sharing and Video Hosting at Photobucket

ok, so I converted the 1.46mb bmp file into dds file using directx texture tool. Now the texture is 5.87 mb (omg) and it takes even longer to load. What did I do wrong? I saved it in X8R8G8B8 format.
superpig - that was great, thanks :)

Quote:Original post by Sangha Im
ok, so I converted the 1.46mb bmp file into dds file using directx texture tool. Now the texture is 5.87 mb (omg) and it takes even longer to load. What did I do wrong? I saved it in X8R8G8B8 format.


Hehe yup, you're doing something wrong :D

I tried an 800x600 image, here's my results:

BMP - 1,407KB
PNG - 392KB
DDS - 1,876KB
DDS(DXT1) - 235KB

DDS stores more information than the BMP format.
And DXT1 uses compression (lossy).
Loading time for these things is usually irrelevant. It's either a one-time delay at startup or loaded in the background during the game. Loading files from disk is an inherently slow operation and will vary a lot from system to system.

If you're in a situation where the speed of this operation matters you should either a) reconsider your design or b) stop worrying about it, because it's not a problem (if it's loaded once at the start or in the background, it's not a problem.)
Ra
As I explained, an uncompressed DDS is usually larger than a BMP because the DDS also contains the mipmaps for the BMP image, which for a BMP would have to be generated at runtime.

You've still not fixed the size of the image to be power-of-two sized, have you? You really need to do that before continuing to experiment with this stuff.

Edit: Also, if your sprites don't use translucency, only pure 1-bit transparency, you should probably be using DXT1 format instead of X8R8G8B8. Don't color-key, it doesn't work when your textures are filtered.

Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse

This topic is closed to new replies.

Advertisement