贴图比较:DDS vs TGA vs PNG

本文探讨了在游戏开发中选择纹理格式的问题,重点比较了DDS、TGA和PNG三种格式的优缺点。作者偏爱无损且支持MIP映射的格式,最终结论是,PNG适合开发和原始文件,对于单位的团队颜色,推荐使用DDS(DXT3),而特征、地图和无团队颜色的单位则推荐DDS(DXT1)。对于高分辨率工作流程,建议使用PNG并用批处理工具如The Compressonator转换为DDS格式。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

原文: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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值