Alternative approach to asset compression
Alternatively, you can create .xz files using archive utilities as 7-Zip, XZ Utils or others.
Archiving with external tools is recommended as a time-saving measure for teams working on big projects. You might need to write some batch scripts to archive your assets in automated way.
Verge3D implementation of an .xz decompressor puts some restrictions on compressed files due to optimization purposes, so not every .xz file can be loaded. .tar.xz files are also not supported. Considering this, it's recommended to use settings described below.
Windows
1) A popular file archiver 7-Zip can be used for creating .xz files.
To compress a file you can right click it, and then choose "7-Zip" → "Add to archive..." — this opens the corresponding dialog window:
The archivation settings should look like this:
- Archive format: xz
- Compression level: any (Normal, Maximum and Ultra give best results)
- Compression method: LZMA2 (the only available option)
- Dictionary size: up to 8 MB - the more the better (more than 8MB is not supported by the engine)
- The rest of options can be left by default.
Also you can use a command line version of 7-Zip instead:
7z.exe a -m0=LZMA2:d23 scene.gltf.xz scene.gltf 7z.exe a -m0=LZMA2:d23 scene.bin.xz scene.bin
2) Alternatively, you can use a special command line tool called XZ Utils. Its Windows binaries are available here in the Pre-built binaries section.
The usage is simple:
xz.exe -k -f -6 scene.gltf xz.exe -k -f -6 scene.bin
Linux
1) A 7-Zip command line port can be available out of the box or from official repositories as a package named p7zip.
The usage is similar to the one in Windows:
7z a -m0=LZMA2:d23 scene.gltf.xz scene.gltf 7z a -m0=LZMA2:d23 scene.bin.xz scene.bin
2) XZ Utils is also available out of the box or from official repositories in most Linux distros.
The usage is similar to the one in Windows:
xz -k -f -6 scene.gltf xz -k -f -6 scene.bin
macOS
1) The 7-Zip command line port can be installed via Homebrew as a package named p7zip:
$ brew update $ brew install p7zip
The usage is the same as in Linux.
2) The XZ Utils are available out of the box in latest versions of macOS. The usage is the same as in Linux.
