Faster Loading with Asset Compression

In Verge3D, scene files may be compressed using the highly effective LZMA compression algorithm, thus allowing to significantly reduce the size of the files. At the same time, LZMA offers fast decompression on the browser side. Typical compression rates observed for Verge3D scenes are: 20x for the .gltf files and 6x for the .bin files.

When to Use It

Using asset compression is especially recommended in the following cases:

Size comparison chart
Size comparison for a sample file: raw vs GZIP-compressed vs LZMA-compressed

Exporting Compressed Files

Verge3D supports loading of scene files compressed in the .xz file format, which incorporates the LZMA compression algorithm. To enable creating .xz files automatically upon export, you can simply turn on the corresponding option in the export settings.

Enable LZMA compression in Blender
Enable LZMA compression in 3ds Max
Enable LZMA compression in Maya

Loading Compressed Files

The compressed .xz files (for example, my_awesome_app.gltf.xz and my_awesome_app.bin.xz) should appear near the original ones. What is left is to enable loading them in your app. To do this, go to Puzzles...

Button to run Puzzles logic of My Awesome App

...and switch to the init tab:

Init tab in Puzzles

Drag out the configure application puzzle from the Initialization category, if it is not already present in the workspace, and turn on the compressed assets checkbox on it:

Enable LZMA compression in configure application puzzle

Finally, click the Save button. That's it!

Checking Your Files

To ensure that your app now actually loads compressed assets, 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.

Checking compression in Chrome console

Reload your app so that the console starts displaying files from the beginning. Find the scene files in the list - if everything is ok, they should end with .xz.

Alternatively, you can check whether the compressed assets are enabled by using the performance profile feature.

Enabling Compression for Code-Based Apps

If you don't want to use Puzzles for some reason, follow these steps to enable asset compression for your apps.

Simply change:

const SCENE_URL = 'my_awesome_app.gltf';

to:

const SCENE_URL = 'my_awesome_app.gltf.xz';

in your_awesome_app.js file.

The same applies to .glb and .glb.xz files if they are used instead of .gltf/.bin.

Got Questions?

Feel free to ask on the forums!