A powerful VS Code extension for optimizing and compressing GLB files. This extension acts as a convenient wrapper around the gltf-transform CLI tool, bringing advanced 3D model optimization directly into your editor.
KTX2 Texture Compression: Optimize textures for runtime performance using Basis Universal (ETC1S/UASTC).
Advanced Optimization GUI: Fine-tune specific optimization passes:
Geometry: Weld vertices, simplify meshes (with ratio control).
Textures: Resize, convert formats (WebP, JPEG).
Scene Graph: Dedup, prune unused items, flatten hierarchy, join meshes.
Instancing: Auto-generate GPU instances and palette textures.
Requirements and Installation
This extension is a wrapper around the gltf-transform CLI and KTX-Software tools. You must have both installed on your system for the compression commands to work.
1. Install gltf-transform CLI
The core transformations are handled by gltf-transform. Install it globally using npm:
The release package contains the necessary executables. You will need to ensure the toktx executable is placed into a directory that is included in your system's PATH environment variable (e.g., /usr/local/bin or similar on macOS/Linux, or adding the directory to PATH on Windows).
Usage
Right-click on any .glb file in the VS Code Explorer to see the available commands:
Compress GLB (Draco + KTX): Applies standard Draco and KTX2 compression.
Compress GLB (Draco): Geometry compression only.
Compress GLB (KTX): Texture compression only.
Compress GLB (Advanced...): Opens a configuration panel for detailed control.
Configuration
If gltf-transform is not in your system PATH, you can specify its location in VS Code Settings:
glb-compressor.cliPath: Absolute path to the gltf-transform executable (default: gltf-transform).