游戏邦在:
杂志专栏:
gamerboom.com订阅到鲜果订阅到抓虾google reader订阅到有道订阅到QQ邮箱订阅到帮看

阐述手机图像的贴图压缩技术标准及作用

发布时间:2013-04-23 14:48:38 Tags:,,,,

作者:Alexandru Voica

贴图压缩技术不断发展,导致压缩品质和效率大大提高,从而使手机图像在2bpp和4bpp的分辨率下也能呈现无比伦比的效果,同时降低手机系统内存的使用率和GPU处理压力。

贴图在手机和电脑图像中无处不在。贴图使大量应用如游戏或导航应用显得更加逼真。智能机、平板和便携游戏机用户对图像品质、加载时间的要求比较高。一般来说,为了提高整体品质,贴图对分辨率的要求会越来越高。这意味着计算机系统必须能够正确结合特性、原图像、计算性能和软件工具,从而有效地利用所有可用资源。

内存、品质、电量、性能:贴图压缩的四个关键

现在的许多手机应用可以提供电脑级品质的图像,因此大多数开发者已经开始关注将支持OpenGL ES作为嵌入式设备的主要标准。这意味着必须使用占用更多内存和大量数据空间的细节贴图。开发者了解手机游戏市场的需求,自然会选择压缩贴图。

电量有限始终是嵌入式设备的主导因素。软件开发者和硬件工程师应该知道,内存访问是除了显示以外电量消耗的最重要原因。在PowerVR的基于拼图的延迟渲染的帮助下,Imagination已经成功地让大多数处理工作保持在芯片上,而且图像处理流程架构已经被优化至贴图解码水平,从而为行业提供最先进、最通用的贴图压缩执行办法。

现代计算平台有共享的、统一的内存架构。多核CPU、多线程GPU和其他处理单元都会争夺RAM资源,所以内存带宽对手机非常重要。贴图压缩留下的贴图痕迹更少,因此从主内存到GPU的传输量就减少了,这样渲染或其他计算任务(如用OpenCL做游戏物理或图像处理)完成的速度就会更快。

与台式电脑相比,嵌入式设备的存储器选项是相当有限的。贴图压缩不只减少应用的内存痕迹,而且能减少游戏对智能手机和平板台的存储占用量。因为内存和存储量越来越重要,用户更加期望游戏运行的同时还能处理多个任务。虽然文件压缩方案如PNG的尺寸通常更小,例如压缩后的贴图如PVRTC不必解压成完整大小,而应用仍然可以运行。另一个优势是,压缩后的贴图通常可以通过zip或其他文件压缩方案再进一步压缩。

PVRTC2_PVRTC_ETC1_ETC2(from gamasutra)

PVRTC2_PVRTC_ETC1_ETC2(from gamasutra)

(最常用的贴图压缩格式是:ETC1, ETC2, BC1, PVRTC和PVRTC2)

最后,对手机设备而言,视觉效果是另一个决定性因素。因为渲染系统如GPU可以接受有损压缩,大部分贴图压缩算法与像素块的固定尺寸的某些分层形式有关。但随着高分辨率显示成为便携设备的共同特征,在图像品质和压缩因素之间取得平衡成为编写优化手机的应用的必要步骤。

为什么使用贴图压缩?

核心OpenGL ES 2.0规格没有指定的压缩贴图格式,且支持加载多种压缩贴图数据。因为越来越应用支持在多个操作系统中(游戏邦注:包括iOS、Android、BlackBerry 10、Windows 8)中运行,所以必须使用统一的贴图压缩格式,以保证10亿部以上的设备上的体验操持一致。因为所有的PowerVR Series5/5XT和Series6都支持以上贴图压缩标准,所以开发者可以得到双重好处:相比于基于块的压缩技术,视觉效果大大提升,同时内存痕迹大大减少。

即使基于块的方式如S3TC和ETC1不能保持矩形区的连续性,但有其他格式可以解决这些问题,从而产生更好的视觉效果。例如,PVRTC不会把贴图当作独立的贴图块,而是将贴图显示为一组低分辨率图像。这些高级图像由一个完整分辨率但低精度、调制的图像以像素为基础混合起来

PVRTC2以我们之前的贴图压缩标准PVRTC为基础,但添加了若干重要改进如NPOT和贴图集支持。因此,如果你的目标平台有Series5XT或Series6 GPU,你应该使用PVRTC2,这样效果会比PVRTC更好得多。

NPOT(非2次方)贴图是与Series5XT or Series6 GPU一起引入的,它取消了象素表面必须匹配2次方的要求,特别是对于大型贴图:如1600×1200贴图本需要2048×2048象素表面,这会浪费大量内存。对于经常使用许多小贴图的应用,使用来自贴图集的子贴图可以更有效地使用图形硬件的资源。基于贴图的游戏非常适合使用贴图集。

手机贴图压缩类型的对比

目前有6种比较常见的、OpenGL ES支持的压缩类型:

- PVRTC,Imagination广泛运用的PowerVR贴图压缩

- PVRTC2,最近升级的PowerVR贴图压缩

- ETC1(Ericsson贴图压缩)和ETC2/EAC(用ETC1反向兼容,强制OpenGL ES 3.0图像标准)

- ASTC (自适应伸展贴图压缩), OpenGL和OpenGL ES新的可选择扩展

- ATITC (ATI贴图压缩)

- S3TC(S3贴图压缩)也叫作DXTn、DXTC或BCn

以下是结果:

PVRTC2_4bpp_2bpp_ETC1_ETC2_BC3(from gamasutra)

PVRTC2_4bpp_2bpp_ETC1_ETC2_BC3(from gamasutra)

PVRTC_ATITC_ETC1_BC1(from gamasutra)

PVRTC_ATITC_ETC1_BC1(from gamasutra)

贴图压缩技术可以提高缓存使用的效率。当在最后的渲染过程有需要时,PowerVR架构只解压贴图,从而极大减少芯片上的带宽和处理压力。这就是为什么贴图压缩格式是并且始终是所有手机图像架构的关键部分。(本文为游戏邦/gamerboom.com编译,拒绝任何不保留版权的转载,如需转载请联系:游戏邦

Why efficiency is key in texture compression standards for mobile graphics

by Alexandru Voica

Imagination’s PVRTC and PVRTC2 texture compression technology provides significant enhancements in quality and efficiency offering application developers unrivaled performance at 2bpp and 4bpp resolutions while lowering system memory usage and reducing GPU processing overhead for the low power-driven world of mobile graphics.

Textures are ubiquitous in mobile and desktop graphics. They add a degree of realism to a wide range of applications like games or navigation apps where a combination of factors such as image quality and loading times are vital to smartphone, tablet and portable console users. Typically such content is increasingly pushing for higher quality on higher resolutions in order to raise the overall quality bar. This means computing systems need to have access to the right combination of features, raw graphics and compute performance and software tools to make efficient use of all available resources.

Memory, quality, power, performance: the four horsemen of texture compression

Many mobile applications today can offer desktop quality graphics and therefore most developers have focused on supporting OpenGL ES as the main standard for the embedded market. This implies using detailed textures which require more memory and large data sizes. Compressing textures is a natural choice for developers who understand the requirements of the mobile gaming market.

Limiting power consumption is what has always driven the embedded market. Software developers and hardware engineers should know that memory accesses are the most important cause of battery drain next to keeping the display lit. With PowerVR’s tile-based deferred rendering, Imagination has managed to keep most of the processing on chip and our graphics processing architecture has been optimized right down to the texture decoding level, making sure that we provide the industry’s leading, most popular implementation  for texture compression.

Modern computing platforms have shared, unified memory architectures. A multi-core CPU, a multi-threaded GPU and other processing units all compete for the same RAM resources, so memory bandwidth becomes vital for mobile. Texture compression permits smaller texture footprints and therefore the size of transfers from the main memory to the GPU is reduced, allowing rendering or other computing tasks (like doing game physics or image processing with OpenCL ) to complete faster.

Memory storage options for embedded devices are quite limited compared to desktop PCs. Texture compression not only reduces your application’s memory footprint, it also allows you to decrease the amount of storage your game occupies on a smartphone and tablet. As memory and storage sizes are becoming increasingly important, expectations around multi-tasking while gaming have also continued to rise. While a file compression scheme like PNG could often have a lower size, a PVRTC texture will not need to be decompressed to full size while the app is running. Another advantage is that compressed textures can always be compressed further via zipping or other file compression methods.

PVRTC2 and PVRTC compared against ETC1, ETC2 and BC1

Finally, visual quality is also a determining factor even for mobile devices. Because lossy compression can be tolerable in a rendering system such as a GPU, most texture compression algorithms involve some form of quantization for fixed-size blocks of pixels. But as high-resolution displays for portable devices start to become a common feature, getting the right balance between image quality and compression factors is a necessary step in writing an app optimized for the mobile world.

Why use PVRTC and PVRTC2?

PVRTC and PVRTC2 are Imagination’s proprietary texture compression standard for our PowerVR graphics cores.

The core OpenGL ES 2.0 specification does not define a particular compressed texture format but supports the loading of a wide range of compressed texture data. As more developers are writing apps that run across various operating systems (iOS, Android, BlackBerry 10, Windows 8), using PVRTC will ensure the same consistent experience across more than 1 billion devices. As all our PowerVR Series5/5XT and Series6 support the PVRTC texture compression standard, developers will enjoy the best of both worlds: considerable visual enhancements and a significant reduction in memory footprint compared to block-based compression techniques. In addition to this, they will benefit from the many other advantages of the PowerVR GPU architecture such as high hardware efficiency, a low power design, and unrivalled performance with reduced area costs.

The main aim of PVRTC is to avoid the discontinuities along rectangular regions that frequently occur with block-based methods such as S3TC and ETC1. Rather than consider the texture as independent blocks of texels, it represents the texture as a pair of low-resolution images, which are bilinearly upscaled. These upscaled images are, in turn, blended on a pixel-by-pixel basis, by a full resolution, but low precision, modulation image.

Its other main advantage is the support of RGBA in both 4bpp and 2bpp modes. If you want to get really specific about the mathematical wizardry behind this, there’s a whitepaper on the subject written by Simon Fenney which you can access on our website.

Using PVRTC not only gets you very high compression factors of 8:1 for 4bpp or (amazingly) 16:1 for 2bpp and a superior image quality, but also ensures that your application is optimized for the hardware platforms on which it runs as there is a direct correlation between the choice of the PVRTC scheme and an enhanced user experience.

As mentioned, PVRTC also supports both opaque (RGB) and translucent (RGBA) textures. Alpha data is stored only for areas that it is actually needed, so if local area is opaque, all the available data will be used to store RGB data. Although the PVRTC 2bpp format offers the highest memory and bandwidth savings, it’s important to consider textures on a case by case basis so developers should try both 4bpp and 2bpp to decide which works best for them. We’ve made sure that by choosing either PVRTC 2bpp or PVRTC 4bpp, you will still have significantly higher quality with no compromises in memory bandwidth, power consumption or performance.

To get a detailed look at how PVRTC works, including the data word structure and a short explanation of the texture compression algorithm, check out this blog article I’ve written a while ago.

PVRTC2 builds on the success of our previous texture compression standard, PVRTC, by bringing several vital improvements. Therefore, if your target platform has a Series5XT or Series6 GPU, you should use PVRTC2 as the results will be significantly better compared to PVRTC.

Alongside RGB and RGBA support with 4bpp and 2bpp encoding, PVRTC2 offers better image quality, especially for textures with large areas of colour discontinuity. Developers will not have to worry about texture manipulation techniques such as border expansion to eliminate previous issues in normal mapping or for collection of sub-images (texture atlases).

Non-tiling textures will also look much better thanks to the addition of dedicated modes for dealing with areas of high contrast between texture sections. This also simplifies working with images in a skybox as borders around them are no longer needed.

To increase the efficient use of memory, PVRTC2 also introduces support for NPOT (Non Power of Two) textures that were introduced with OpenGL ES 2.0. These textures eliminate the need for increasing pixel surfaces to match powers of two, especially for larger texture dimensions: for example a 1600×1200 texture would have required using a 2048×2048 pixel surface which wasted a lot of memory. PVRTC2 can natively support any size the developer chooses to use.

For applications that use many small textures frequently, using sub-textures from a texture atlas can be often a more efficient way of using the graphics hardware’s resources. Tile-based games usually benefit greatly in performance from a texture atlas. PVRTC2 supports sub-texturing at data-word boundaries (4×4 or 8×4 for PVRTC2 4bpp or PVRTC2 2bpp respectively).

To get a detailed look at how PVRTC2 works, including the data word structure and a short explanation of the texture compression algorithm, check out this blog article I’ve written a while ago.

A comparison of texture compression types for mobile

There are currently six well-known compression types supported by OpenGL ES:

- PVRTC, Imagination’s widely used PowerVR texture compression

- PVRTC2, the recently updated PowerVR texture compression

- ETC1 (Ericsson texture compression) and ETC2/EAC (backwards compatible with ETC1 and mandatory in the OpenGL ES 3.0 graphics standard)

- ASTC (Adaptive scalable texture compression), a new optional extension for both OpenGL and OpenGL ES

- ATITC (ATI texture compression)

- S3TC (S3 texture compression), also called DXTn, DXTC or BCn

This case study will focus on PVRTC and PVRTC2, comparing them to other compression standards supported by existing silicon to test their visual efficiency.

For PVRTC and PVRTC2, the PVRTexTool from the PowerVR Graphics SDK v3.0 has been used to compress the images mentioned above. Our tool includes an intuitive GUI, support for other popular texture compressions formats and implements error metrics which allow you to compare between results.

These are the results:

More comparissons and results for PVRTC and PVRTC2 can be found on Imagination’s PowerVR developer blogs.

Being able to have textures compressed at all times improves cache use efficiency. The PowerVR architecture only decompresses texels when needed in the final rendering process, resulting in significant reductions in on-chip bandwidth and processing power. This is one of many reasons why PowerVR PVRTC and PVRTC2 have been, and continue to be, a key part of every generation of PowerVR graphics architecture, including the forthcoming Series6.(source:gamasutra)


上一篇:

下一篇: