Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

AngelForce

Best texture format??

This topic is 5811 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok, I''m starting making a 2D game with dx8 and I wondered, which is the best format to use for my images... TGA seems to be used quite often, but is it lossless? PNG interests my, but the decompressing seems not very easy which is best/are there better ones? ...and how would I display a fullscreen image(eg a menu) with d3d? split it into severall peaces(as you do when you scoll it) so it works with textures(max 256*256) or is there a better way? Thanks for your replies! AngelForce -- If you find any mistakes, you''re allowed to keep ''em! ''When I look back I am lost.''

Share this post


Link to post
Share on other sites
Advertisement
Ahh, my favorite question: How to do fulllscreen images in D3D with the 256 limit...

Well, first things first. About picture formats: I can not tell you which texture format is ''best'' because it depends on your purpose. Having ''zero loss of quality'' can be a bad thing if you wind up with too many texture, aka lots of big files on disk. So when I have to render a fullscreen background made by an artist. A JPG with reasonable compression saves disk space and nobody notices the pixel imprecisions that JPG conversion gives. Ahem, texture choices:

TGA is indeed a ''zero loss'' format, but has no compression so its big. And older versions of Paint Shop Pro can''t save the alpha channel in TGA. Gr. JPG I love for fullscreen art because you don''t notice JPG compression on artist renditions plus you save loads of disk space. Oh, a tip: Learn to use the DxTex utility that comes with the DirectX SDK. The DDS formats are native to DirectX and allow for a variety of bit depths in 16 and 32 bits. Furthermore, the DXT1-5 ''Surface formats'' are actually compressed to save disk space! (You lose lots of quality compared to a jpg though). DxTex mostly allows you to ''build'' a DDS file from TGA or BMP files, but there exists a great plug-in for Photoshop (made by NVidia) which shows your texture in various DDS formats before you save it.

...Anyway, back to fullscreen images... I find that the best way to work is to load a large fullscreen jpg in memory, create a memory-based surface holding that jpg with the format of the current backbuffer. Then it is time to create a series of 256x256 ''textures'' (again with the backbuffer D3DFORMAT) which will have their underlying surfaces filled with the large master surface data. Presto! A few quads make your large screen.

Have a look at http://www.mvps.org/directx/articles/splash_screen.htm for good example code.

=^.^= Leaders and teachers should remember: It is best to offer others what they Need, not what they Want.

Share this post


Link to post
Share on other sites
I *think* it''s possible to save a lossless jpeg, though the compession will be (substantially) less.

I would recommend using a compressed format for your game, but keeping bitmaps copies of your originals somewhere. That way if you want to change something, you won''t have to worry about cumulative loss (if this is a problem - I''m not sure).

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
png is nice. just use libpng.

Share this post


Link to post
Share on other sites
S3TC is widely supported.
Use DXTC tool (note that the one in DX8 SDK has a bug), to make a DDS file.

That''s easy, fast and usefull.

You don''t even need to decompress it since it''s the format the hardware will use.

-* So many things to do, so little time to spend. *-

Share this post


Link to post
Share on other sites
Ok, now I''m torn between DXTC and PNG...
PNG seems to compress more(lossless), but it will be very difficult to decompress...
DXTC seems nice, but how much does it compress?? (I read about 50%...is it true for 32Bit images?) And why does it loose quality?

And thanks for the ''How to do fullscreen images''-answer!

AngelForce

--
If you find any mistakes, you''re allowed to keep ''em!

''When I look back I am lost.''

Share this post


Link to post
Share on other sites
S3TC is lossy, becuase it approximates the image with less data than the original, but on the other hand, it has a static compression rato (50%, as you say, may be true, I don''t remember) which means you are guaranteed less data. It''s impossible to both guarantee lossless compression and a compression ratio below 100%.

Share this post


Link to post
Share on other sites
I could argue with that BrotherBob! Gif formats use lossless compression by performing a compression on the -data-. Much like Zip files do.

You .zip files work, don''t they? There ya go: Lossless compression of the file. Unfortunately .gifs aren''t directly supported in DirectX. Heh.

Anyway, a partial loss can be perfectly acceptable: 70% JPGs on most art and DXT3-4 in DDS give pretty good results, depending on the game they''re perfectly acceptable: If you''re making a MYST-style game, worry about loss a lot. If you''re making a FPS, nobody''s going to stop and stare at a shaded wall to find the slight shade discrepancy, right?

What kind of textures will you use for which game anyway? A cartoonesque FPS? A classic adventure game with good artwork?

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!