In Verge3D, textures may be compressed using the highly effective KTX2/BasisU compression algorithm, thus significantly reducing GPU memory consumption and improving rendering speed.
- Enabling Texture Compression
- Checking Your Files
- Tweaking Compression
- Special Case - HDR textures
Enabling Texture Compression
To enable texture compression automatically upon export, you can simply turn on the corresponding option in the export settings.
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.
There is an option available for each texture to tweak the compression algorithm:
- Choose best algorithm automatically. Corresponds to using UASTC in the current implementation.
- modern method which offers best quality. It is good for everything including normal maps, ORM textures, etc.
- 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 texture compression.
Special Case - HDR textures
Besides genuine texture compression, all HDR images are compressed with 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.
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's not always true for data transferred over network. When using UASTC (or Auto) compression algorithm, you might experience increase of your texture files. If network bandwidth is priority, disable texture compression or use more efficient ETC1S algorithm.
Compression requires additional time to compress your data during export.
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
Do not use ICC profile for your PNG images. It will increase the size of your textures and prevent them from being compressed.
Not compatible with AR mode on iOS devices
Disable compression if you need to convert your models to USDZ to be shown in AR Quick Look mode on Apple devices. Alternatively, use two separate scenes for AR and non-AR modes or generate USDZ assets statically, e.g by using your modelling suite or model converter. See here more info.
Feel free to ask on the forums!