Add gltfpack for smaller files
An optional free tool. With it on your PATH, the converter compresses its GLB files with Meshopt, which can make them many times smaller. How to install it and how to check.
The converter can compress the models it writes with Meshopt compression, and can simplify them while it does. It does that through a separate free program called gltfpack. The app works without it: the files are simply larger. If gltfpack is installed and findable, compression turns on by itself, and the README of the app puts the saving at about ten times for a typical model.
What “findable” means
The converter asks the system for a program named gltfpack, the same way a terminal does. It is found when the folder that holds it is on your PATH, which is the list of folders the system searches for programs. That is why an installed gltfpack that is not on the PATH does nothing.
Install it with npm
This is the way the converter itself suggests. It needs Node.js, a free program for running JavaScript, from https://nodejs.org. Install Node.js with its normal installer first, then open a new terminal and type:
npm install -g gltfpackThe -g means “for the whole computer”, which puts gltfpack on the PATH for you.
Or download the program
The author of the tool publishes ready-made downloads for each system at https://github.com/zeux/meshoptimizer/releases, and describes the tool at https://meshoptimizer.org/gltf/.
- Download the gltfpack file for your system from the releases page.
- Put it in a folder that you will keep, for example
C:\Toolson Windows or/usr/local/binon a Mac. On a Mac, in a terminal, make it runnable withchmod +x gltfpack. - Windows: press the Windows key, type “environment variables” and open Edit environment variables for your account. Select Path under User variables, press Edit, then New, paste the folder, and press OK on every window. A Mac folder such as
/usr/local/binis on the PATH already. - On a Mac, the first run of a downloaded program can be blocked. Right-click it in Finder, choose Open once, and confirm.
Check that it is found
- Open a new terminal. A terminal that was open during the install does not see the change.
- Type
gltfpack -hand press Enter. A list of options means it works. “Command not found” or “is not recognized” means the folder is not on the PATH yet. - Quit MeshOptimiser from Menu, Quit app, and start it again with its launcher. The server reads the PATH when it starts, so it has to be restarted to see the new program.
Convert a STEP file. The launcher window then shows a line that starts with post: and says gltfpack. Without gltfpack, a conversion that asks for compression prints “gltfpack not on PATH” and carries on without it.
Using it from the command line
The options that use it, such as --meshopt and --simplify, are explained in The command-line converter.