贴图比较:DDS vs TGA vs PNG

原文:https://springrts.com/phpbb/viewtopic.php?t=18231

I can see this debate has raged awhile and opinions differ but I'm having trouble working out the factual information from the opinions and out-of-date stuff. Basically I'm at the start of my mod work and I want to use the "best" texture format going forward. 

I'd prefer the format not be lossy and to be capable of mip-mapping. It would be good for it to have good performance on game start and during the game. It should also be reasonable easy to load in image software. I know I can't have everything but my preference would be for performance over other concerns (I'll be running games with very high unit counts).

My preferred format is currently PNG, but I was wondering if anyone could shed some light on the matter as far as the current engine goes.

PNG (32bit) / TIFF
Lossless
Very good compression (use LZW or Deflate for Tiff)
Excellent image software support
No embedded mip-maps

TGA
Lossless
Low/No compression
Packs well in archives
No embedded mip-maps

DDS DXT3
Lossy
Supports embedded mip-maps
Excellent compression
Texture artifacts / blurring
Requires plug-in for most image software

DDS DXT5
Lossy
Supports embedded mip-maps
Excellent compression
Texture artifacts / blurring
Requires plug-in for most image software

DDS R8G8B8A8 
Uncompressed
Supports embedded mip-maps
Inefficient VRAM usage
No artifacts
Requires plug-in for most image software

Questions:

Does Spring create and use mip-maps from loaded PNGs? If so is this a slow process?
Answer(s): Sometimes and maybe. Automatic compression and mipmapping of all image formats except DDS happens on load if "compress textures" is enabled in the players Spring Settings. This is off by default in current Spring builds. The second answer is maybe because I don't have a benchmark for how noticeable the loading delay is.

Also, given that mod archives are Zip/7zip are there actually any download savings from DDS/PNG compression? (you generally can't compress a compressed file much further)
Answer: TGA compresses the best. The others don't compress much further than they already are.

My Conclusions
(for those not interested in the whole rambling discussion)

Convenience / Development / Original file:
PNG32, TIF or TGA. All are lossless, well supported everywhere and have alpha. TGA is best if you don't want to distribute as DDS because it packs well in mod archives well and loads quickly.

Units with teamcolor:
DDS(DXT3) with auto mipmaps (unless teamcolor is graduated, then DXT5)

Features / Maps / Units with no teamcolor:
DDS(DXT1) with auto mipmaps

Specular / Glow Map / Transparency:
DDS(DXT1) with auto mipmaps

I'll be working in PNG at high resolutions then using a batch conversion tool like The Compressonator to downsample and generate the DDS files prior to packaging for releases.

I believe this covers everything I need except in some fringe cases like particles / sprites etc where DDS is incompatible or mipmaps overkill.

你可能感兴趣的:(Texture)