Google and Binomial Open Code for Basis Universal Texture Compression System

Google and Binomial have opened source code Universal Basis, a codec for efficient texture compression, and an associated universal ".basis" file format for distributing textures based on images and videos. The reference implementation code is written in C++ and supplied licensed under Apache 2.0.

Basis Universal complements earlier published the Draco 3D data compression system and is trying to solve the problem with the supply of textures for the GPU. Until now, developers have been limited to choosing between low-level formats that achieve high performance but are GPU-specific and take up a lot of disk space, and other formats that allow for size reduction but cannot compete with GPU textures in terms of performance.

The Basis Universal format achieves GPU-native texture performance, but provides a higher level of compression.
Basis is an intermediate format that provides fast transcoding to various low-level GPU texture formats used on both desktop and mobile devices before use. Currently, translation to PVRTC1 (4bpp RGB), BC7 (6 RGB mode), BC1-5, ETC1, and ETC2 is supported. Support for ASTC format (RGB or RGBA) and 4/5 RGBA modes for BC7 and 4bpp RGBA for PVRTC1 is expected in the future.

Google and Binomial Open Code for Basis Universal Texture Compression System

Textures in the basis format take up 6-8 times less video memory and require about half the data transfer than standard textures based on the JPEG format and 10-25% less than textures in the RDO mode. For example, with a JPEG image of 891 KB and an ETC1 texture of 1 MB, the Basis data size is 469 KB in the highest quality mode. When placing the texture in video memory, the textures in the JPEG and PNG formats used in the tests used up 16 MB of memory, while for textures in the format
Basis needed 2 MB of memory for translation in BC1, PVRTC1 and ETC1, and 4 MB for translation in BC7.

Google and Binomial Open Code for Basis Universal Texture Compression System

The process of migrating existing applications to Basis Universal is quite simple. It is enough to recode existing textures or images into a new format using the β€œbasisu” utility provided by the project, choosing the required quality level. Next, in the application, before the rendering code, you need to initialize the basisu transcoder, which is responsible for translating the intermediate format into the format supported by the current GPU. At the same time, images throughout the entire processing chain remain compressed, including downloading in compressed form to the GPU. Instead of proactively recoding the entire image, the GPU selectively decodes only the necessary parts of the image.

It is supported to save non-uniform texture arrays (cubemap), volumetric textures, texture arrays, mipmap levels, video sequences or arbitrary texture fragments in one file. For example, it is possible to pack a series of images in one file to create small videos or combine several textures using a common palette for all images and deduplication of typical image templates. The Basis Universal encoder implementation supports multi-threaded encoding using OpenMP. The transcoder currently only works in single-threaded mode.

Additionally available a Basis Universal decoder for browsers, delivered in WebAssembly format that can be used in WebGL-based web applications. Ultimately, Google intends to support Basis Universal in all major browsers and promote it as a portable texture format for WebGL and a future specification. WebGPU, which is conceptually similar to the Vulkan, Metal, and Direct3D 12 APIs.

It is noted that the ability to embed video with subsequent processing only on the GPU side makes Basis Universal an interesting solution for creating dynamic user interfaces on WebAssembly and WebGL, which can simultaneously display hundreds of small videos with minimal CPU load. Before the availability of SIMD instructions in WebAssembly with traditional codecs, this level of performance is not yet achievable, so texture-based video can be used in areas where conventional video is not applicable. Currently preparing to publish code with additional optimizations for video, including the ability to use I-frames and P-frames with adaptive padding (CR) support.

Source: opennet.ru

Add a comment