Friday, March 30, 2018

Basis update - now with PVRTC support!

Basis (our new GPU texture compression product and the successor to our popular open source crunch lib) now supports PVRTC1, along with ETC1 and BC1-5 (DXTc). This means a .basis file can be utilized on pretty much every GPU in the universe that matters, independent of platform or API. A .basis file is conceptually like JPEG but for GPU texture data, and can be used on the web (using Emscripten and WebGL) or by native apps (using a small C++ transcoder library).

All textures are 1024x1024 (due to PVRTC1 limitations). Click on each one to see them at full-res (they are reduced in size on the page itself).

Each image below was transcoded directly to each GPU format from the .basis file, and then converted to 24bpp .PNG. On my desktop, ETC1 is fastest (~3ms), followed by BC1/4 (~7.9ms), then PVRTC (~37ms). The transcoders (particularly PVRTC) are not yet fully optimized, and are written in straightforward C++. (Update: PVRTC transcode at 1024x1024 is now ~15.4ms, without any SIMD or threading yet.)

The PVRTC transcoder really needs SIMD optimizations, which should give it a nice speed boost (probably around 2-3x). It would be trivial to thread the PVRTC transcoder too. The PVRTC's transcoder's quality is visually somewhere in between PVRTexTool's "Lower Quality" and "Good" settings. In many cases, it looks a little better than "Good", but it's a tossup.

Note that BC3 and BC5 formats are supported by calling the transcoder twice from different input image slices. So a RGBA GPU texture is encoded into two slices (sharing the same codebooks) in a single .basis file, and it transcodes to either two ETC1 textures, a ETC1 texture twice as high, or a single BC5 texture. PVRTC2 and ETC2 support will be very easy and transcode times will be comparable to ETC1 or BC1 (PVRTC1 will always be the most expensive). The PVRTC transcoder doesn't support alpha yet (it's next).

Image: laststarfighter_1024.basis, 133966 bytes, 1.022 bits/pixel

Original:


.basis->ETC1:


.basis->BC1:


.basis->BC4:


.basis->PVRTC:

Image: map_1024.basis, 180603 bytes, 1.38 bits/pixel

Original:


.basis->ETC1:


.basis->BC1:


.basis->BC4:


.basis->PVRTC:


Image: delorean_1024.png, 138894 bytes, 1.06 bits/pixel

Original:


.basis->ETC1:


.basis->BC1:


.basis->BC4:


.basis->PVRTC:



Monday, March 26, 2018

Basis v1.11 with universal GPU texture support has shipped

We've sent drops to two companies so far. This is the first version that supports fast block-level transcoding of .basis files to multiple formats: ETC1 (mobile) or BC1-5 (desktop). This is a major milestone for us, because Basis is the first system available to support efficient platform independent distribution of highly compressed GPU texture data. We've been working up to this release for over a year.

Here's a tiny demo (our first), using the Basis transcoder compiled to Javascript using Emscripten: http://lzham.info/decode_test.html

For some encoded example images created during development, see thisthis, or this post.

You encode your textures/images a single time, store a single set of .basis files (which are approximately the size of JPEG files), download the file on the remote device, and then transcode to the format you need for that device. Our transcoder converts the block-level data to DXT or ETC format GPU texture bits on the fly. The encoder is aware of all the formats and balances the quality levels of each.

.basis files consist of one or more 2D texture "slices", where each slice can be any dimension. Slices can be mipmap levels, tiles, cubemap faces, video frames, etc. - whatever you want.

We think the primary use case for .basis files are web apps of various types, or any kind of app that needs to distribute GPU texture data across a wide range of GPU devices. We've tested this solution on normal maps, diffuse maps, gloss maps, satellite photos, photographs, grayscale images, flight navigation maps, etc.

Anyhow, here's what you get with Basis:

  • bin, bin_linux, bin_osx: DLL/so/dylib's containing the precompiled encoder library (which is closed source) and several command line tools. The main tools are basiscomp (our new .basis file encoder, and our RDO ETC1 compressor) and rdodxt (uses our new RDO BC1-5 encoders that are around 10-25% better than crunch's).
  • basisexample: Shows how to use the encoder DLL to encode .basis or RDO .KTX files.
  • inc: Transcoder library source code/headers.
  • lib: static import library for encoder DLL
  • transcoding_demo: Sample that uses the included transcoder library (provided in source code form in the 
  • rdodxt: Sample that uses the encoder DLL to do RDO BC1-5 compression
I've tried to keep the few API's in the product as simple as possible, so not much documentation is needed for them. The readme file covers them. Encoding involves filling out a struct and calling a single C function in the DLL. Transcoding slices is similar, except you use a couple simple methods in inc/basis_decoder.h.