Verge3D Texture Compression — Soft8Soft
Description: Verge3D supports textures compressed with the KTX2/BasisU compression algorithm. Find out how to enable this feature in your apps.

# Texture Compression

In Verge3D, textures may be compressed using the highly effective KTX2/BasisU compression algorithm, thus significantly reducing GPU memory consumption and improving rendering speed.

Size comparison for a sample lamp model, image courtesy of Khronos® Group.

- Enabling Texture Compression
- Checking Your Files
- Tweaking Compression
- Special Case - HDR textures
- Limitations

#

## Enabling Texture Compression

To enable texture compression automatically upon export, you can simply turn on the corresponding option in the export settings.

Blender
3ds Max
Maya

Also make sure you created an app with Texture Decompressor option enabled (it is enabled by default):

If you forget to enable Texture Decompressor option, simply copy basis_transcoder.js and basis_transcoder.wasm files from the build subfolder of the Verge3D installation folder (e.g. C:\Program Files\Verge3D_for_Blender\build) to your app directory.

#

## Checking Your Files

To ensure that your app now actually loads compressed texture, run your app (either from App Manager or from a website where it is deployed). Open the browser console and switch to the Network tab.

Reload your app so that the console starts displaying files from the beginning. Find the texture files in the list - if everything is ok, they should end with .ktx2.

Alternatively, you can check whether the compressed textures are enabled by using the performance profile feature.

#

## Tweaking Compression

There is an option available for each texture to tweak the compression algorithm:

Blender
3ds Max
Maya

Auto
  Choose best algorithm automatically. Corresponds to using UASTC in the current implementation.
UASTC
  modern method which offers best quality. It is good for everything including normal maps, ORM textures, etc.
ETC1S
  offers best compression and generates smallest files. However, it may cripple textures so you might use it only for non-contrast images (such as grass, wood, bricks, etc).
Disable
  disable texture compression.

#

## Special Case - HDR textures

Besides genuine texture compression, all HDR images are compressed with lossless LZMA (i.e. same method used for glTF files). This makes the HDR files 4x-6x times smaller, although they still occupy the same amount of video memory. This feature is turned off when you set the texture compression setting to Disabled.

#

## Limitations

In general, it's save to enable texture compression for all of your scenes, however you should be aware of some limitations and drawbacks introduced by this feature.

### Compressing requires more data to load over network

As stated in the beginning of this section, texture compression significantly reduces GPU memory consumed by your apps. However, it is not always true for data transferred over network. When using UASTC compression algorithm (or Auto), the textures can get bigger in some cases. If network bandwidth is a priority, disable texture compression altogether or use the more efficient ETC1S algorithm.

Starting from Verge3D 4.2, we implemented a countermeasure to limit the size of compressed textures. Should the resulting image get more than 3x times larger than the original image, the exporter keeps the original uncompressed image intact.

### Slower export

Compression requires more time to compress your data during export. To save time, you can only enable it at final stages of development.

### Supported only for JPEG and PNG textures

Only JPEG/PNG textures can be converted to KTX2. Textures in other formats (WebP, BMP, etc) are left uncompressed.

### Not supported for non-power-of-two (NPOT) textures

If the exporter detects that you try to compress NPOT textures (which we don't recommend using in your apps anyway), it will fallback to regular non-compressed data and prints a warning in the console of your modelling tool.

### Not supported for PNG textures with embedded ICC profile

PNG images with embedded color profile chunks (ICC aka iCCP) are not supported by the texture compressor. As such, to process such images we strip ICC data entirely before passing them to the compressor. In case of non-standard color profiles (non-sRGB) this might result in somewhat distorted colors.

If stripping ICC data is not desirable, disable texture compression for the said images or apply color profile using some image editing software (Photoshop, GIMP).

## Got Questions?

Feel free to ask on the forums!