首页 > 代码库 > Texture Format全解析
Texture Format全解析
【Texture Format全解析】
What internal representation is used for the texture. This is a tradeoff between size and quality.
纹理的压缩方式取决于大小和质量的平衡。
由上图可以看到:
1)RGB Compressed DXT1 > RGB 16 bit
2)RGBA Compressed DXT5 > RGBA 16 bit
3)非 Normal 情况下,RGBA Compressed DXT5 > RGBA 32 bit
【iOS平台】
上图可以看到,前一节中的DXT压缩无法应用于iOS设备上,取而代之的理PVRTC技术。从上图可以看出:
RGB Compressed PVRTC 4 bits > RGB 16 bit
RGB Compressed PVRTC 4 bits > RGB Compressed PVRTC 2 bits
RGBA Compressed PVRTC 4 bits > RGBA 16 bit
RGBA Compressed PVRTC 4 bits > RGBA Compressed PVRTC 2 bits
RGBA Compressed PVRTC 4 bits > RGBA 32 bit
【Android】
Unless you’re targeting a specific hardware, like Tegra, we’d recommend using ETC1 compression. If needed you could store an external alpha channel and still benefit from lower texture footprint.
If you absolutely want to store an alpha channel in a texture, RGBA16 bit is the compression supported by all hardware vendors.
RGB Compressed ETC 4 bits 适合于diffuse-map,如果图像有alpha通道,为了全平台使用,必须使用RGBA16。
If your app utilizes an unsupported texture compression, the textures will be uncompressed to RGBA 32 and stored in memory along with the compressed ones. So in this case you lose time decompressing textures and lose memory storing them twice. It may also have a very negative impact on rendering performance.
如果使用了不支持的压缩技术,那么带带来浪费解压时间,以及花费双倍内存的情况,有极大的负面影响。
【Texture Size】
If the platform or GPU does not support NPOT texture sizes, then Unity will scale and pad the texture up to next power of two size, which will use even more memory and make loading slower.
如果纹理不是2的次幂,Unity会scale、pad纹理,以使得达到2的次幂,这样会花费更多内存,让加载更慢。所以良好的建议是,所有的纹理都必须是2的次幂。
【Mip Maps】
Using mip maps uses 33% more memory, but not using them can be a huge performance loss. You should always use mipmaps for in-game textures.
Mip Map会多花费33%的内存。
【Anisotropic filtering】
Anisotropic filtering increases texture quality when viewed from a grazing angle, at some expense of rendering cost (the cost is entirely on the graphics card). Increasing anisotropy level is usually a good idea for ground and floor textures.
anisotropic filtering只花费gpu时间。
参考:file:///C:/Program%20Files%20(x86)/Unity/Editor/Data/Documentation/html/en/Manual/class-TextureImporter.html
Texture Format全解析