Recommended Graphics Format?
These are primarily questions for the XNA developers...
1) What is the recommended graphics format for textures, bitmapped fonts, etc.?
I'm currently usingBMPfiles but most of the examples appear to useTGA.
2) Also, should I restrict my graphics files to widths and heights of powers of 2 (eg, 128x32, 64x64, etc.)?
Please be verbose. I would like to know*WHY*I should use one format over another, so please don't just respond with "bitmap" or "targa". Thanks! :)
1) I would recommend using anything other than BMP. Bitmaps are an uncompressed file type and that will bloat the size of your game project quickly. My personal choice is to use PNG files. They support transparency very well and tend to be much smaller in size.
2) Yes, you should restrict your graphics files to width and heights that are powers of two. This is a legacy issue for older video cards that will someday go away (once everybody in the world upgrades). Basically, some video cards either choke on an image that isn't a power of 2 (i.e. crash) or will attempt to stretch or shrink the image to one that is a power of 2. This resizing can cause some very unfortunate issues in your game when you are depending on sprites to be in certain location on a tile sheet.
I hope that helps.
I would imagine that NOT to be true for the XBox 360. From what I understand it is primarily for older video cards, newer cards do not have the same power of 2 requirement.
However, someone else would have to really confirm that since I really don't have any actual knowledge on that, it's just what I would imagine to be true.
I'm fairly certain any machine capable of running XNA will be able to cope with non power of 2 textures.
As to the format, I'd go with in order:
DDS - Direct draw surface.. supports everything - cubemap textures, volume textures, transparancy, mipmapping, different surface formats, even normal textures (!)
PNG - Small, compressed, supports full transparancy
TGA - Normally uncompressed though certain software will save it compressed, supports full transparancy
My advice would be not to read standard image formats like BMP, TGA,
etc, from inside your game at all! There are several reasons why this
is a bad idea:
- These formats don't support compression, so if you want your
textures compressed on the graphics card, you'll have to compress them
while loading. That slows down your loading code.
- PNG does support compression, but not in the same way as graphics cards do, so you still have to compress while loading.
- None of these formats support mipmaps, so you have to generate those while loading, which again slows things down.
- The DDS format does support both graphics card style compression
and mipmaps, but it's a pain to work with because most picture editing
programs don't support DDS particularly well.
- And the kicker: none of these formats are available on Xbox! They
all rely on sophisticaed loader functions to convert them into a
hardware-ready format, and that processing code isn't available on Xbox.
The solution? Use the content pipeline. Author your textures using
whatever format you prefer (this really makes no difference, so just
pick whichever is most convinent for your editing program). Add them to
Visual Studio, and the content pipeline will generate mipmaps and
compress them for you as part of the build process, spitting out a nice
compact hardware ready binary file that you can load into your game in
the fastest possible way.
Of course, this functionality isn't available in the beta, so for now I
would just say go with whatever is easiest for you to author.