Optimize 3D Assets with Khronos’ New glTF-Compressor Tool
Interactively tune texture compression size and quality, with support for KTX 2.0 texture generation to optimize performance and memory
The glTF™ open standard 3D asset format from the Khronos Group enables online retailers and adtech platforms to enhance their interactive customer experiences with runtime-efficient, 3D product models. With the latest glTF PBR (Physically Based Rendering) material extensions, artists can create incredibly detailed and realistic assets – but in many cases, they’ve been held back by concerns about how these assets would perform on the web due to large texture sizes. Today, Khronos is releasing the open source glTF-Compressor tool for interactively optimizing and fine tuning texture compression settings, to help users adjust their 3D assets for optimal web delivery.
KTX 2.0 Universal Supercompressed Textures
Asset optimization can have a huge positive impact on the user experience by reducing loading time and boosting visualization performance. Without optimization, detailed high-resolution textures result in increased file size, affecting both download speed and the amount of precious GPU memory used. The glTF-Compressor tool enables glTF assets using KTX 2.0 textures to be easily optimized and generated. The Khronos KTX 2.0 supercompressed texture format enables universally distributable glTF assets that reduce download size and use natively supported texture formats to reduce GPU memory size and boost rendering speed on diverse devices and platforms.
Using glTF-Compressor
glTF-Compressor extends the capabilities of the well-loved Khronos open source glTF Sample Viewer. Users can load and experiment with the predefined list of sample models offered through the glTF Sample Viewer, or load their own glTF assets by dragging and dropping them directly into the viewport.
An interactive texture optimization UI then enables users to fine-tune compression settings and immediately see results through a live 3D asset and 2D image preview. All the textures in the glTF asset are displayed as thumbnails, together with detailed image information such as the format, resolution, usage, file size, and estimated GPU memory size. This can greatly assist the user to narrow down which textures need further optimization and assess the benefits of each compression choice.
Flexible Texture Compression
Users select textures for compression using the checkboxes next to each thumbnail. Textures can also be batch-selected based on how they are being used in the model: for example, all normal maps which may best be compressed in a particular way. glTF-Compressor can compress textures to a variety of target formats including JPG, PNG and WebP, as well as KTX. A number of compression options are offered for the individual target formats, with helpful default suggestions provided for each format that take into account how a texture is being used in the final asset material.
glTF-Compressor offers advanced compression options for the KTX target format that enables fine-tuning of the final texture quality, including downscaling in power of two increments to fit a desired file size budget.
After selecting the textures and specifying their compression options, the “Compress Textures” button starts the compression process. Once finished, before/after results are presented alongside each texture thumbnail for detailed comparison. Information about each of the images is updated with the new image format, resolution, file and GPU memory size.
Side-by-Side Live Texture Comparison
Artists can inspect the quality of the compressed images in a split main UI panel. An interactive slider bar allows users to inspect and compare the original 3D asset images (on the left) with the compressed ones (on the right). Users can zoom in/out or pan the 3D asset and use the slider bar in order to inspect the asset from any angle and zoom factor. They can also utilize the live comparison on the debug channels of the glTF Sample Viewer, provided in the Advanced Controls tab to compare individual textures and channels of the asset.
Compressed textures can also be displayed in a 2D view, via the Compare button above the thumbnail, and inspected using the before/after slider bar. Using the mouse wheel to zoom in/out or pan the image, users can carefully inspect how the texture details were affected after compression. When zooming in, the actual unfiltered texture pixels are displayed, for easier inspection of compression artifacts.
Using this live comparison view, users can carefully and iteratively tweak texture compression parameters to minimize compression artifacts while respecting a desired memory budget.
Exporting Optimized Assets
glTF-Compressor can export the adjusted asset with the newly compressed textures. The exported file format will be the same as the input: a zip file (containing glTF, bin and images files), a glTF file with embedded textures, or a binary GLB file. Any additional data in the input file is preserved and exported.
If textures are converted to KTX and WebP formats, the corresponding glTF extensions are listed automatically in the exported glTF asset.
An accompanying JSON text file can also be exported, containing the user’s chosen compression options for the KTX images, in a format that can feed the toktx command-line compression tool. This is a great way to interactively adjust compression options to their optimal settings on one asset, and then batch process a large library of assets offline using those identical settings.
Khronos invites users to explore the glTF-Compressor tool now, and share their feedback using the glTF-Compressor GitHub repository. For additional guidance on using KTX to optimize 3D assets for web delivery, please explore the KTX Artist Guide and the KTX Developer Guide.