GLB Optimizer for Geometry and Texture Conversion (WEBP and KTX2)

Hello friends,

We are glad to introduce the new GLB Optimizer, the successor of highly appreciated GLB with WEBP Textures Converter.

By default all textures converted to WEBP format with no resize, and geometry is optimized with soft settings to preserve visual appearance.
Just drop some 3D model into it and see the size difference, compare visual quality and download if satisfied.
Instant reload supported - press ‘R’ to reload the file with the new optimization settings applied.

The Select Resize button lets to resize all textures to the chosen dimensions, preserving aspect ratio. For example, a 4096x8192 texture, resized with 2048 setting, will be reduced to 1024x2048.
The Texture Format button lets to choose between Original, WEBP and PNG formats. WEBP is turned on by default.
The Help button shows some information about optimization functions and parameters. To close the information window click the Help button once more.

After the GLB/GLTF uploading (Draco compressed files are not supported at the moment) there are more additional buttons available.

To compare the difference between the original and optimized models use “Comparing Screenshot” function, activated with the button with camera icon.
This function makes pixel comparison between 2 screenshots (original and optimized) and shows the red overlay over mismatched pixels. The number of mismatched pixels and error percentage is displayed in the pop-up message. The overlay layer will disappear after 3 seconds after any mouse movement on canvas.

The Settings button opens the Optimization Settings panel. It is divided into 2 sections (currently): Basic Optimization and KHR Extensions. All Basic Optimization operations don’t require and don’t add any KHR Extensions, meanwhile all operations done from KHR Extensions section will add the corresponding KHR extension to the file.

The Reset button resets all settings to default, including texture format and size, and reloads the page.
To close the Optimization Settings panel click the Settings button once more.

After any settings change one may press R to fast reload the model with the new optimization settings applied.

More functions and extensions will be added in the next releases :slight_smile:

The same pipeline can be used also for automated processing and optimization of 3D assets, for example ones uploaded by users or ones exporting as GLB from some of your applications.
See console messages for some information related to the files processing.

Note that if your GLB file will have validation errors the application will try to correct them (the number of validation errors will be shown in the pop-up message) and then will call Inspector with Validation tab opened, so one may compare. If you see the green checkmark as in the screenshot all validation errors were resolved successfully.

Enjoy and give feedback! - https://glb.babylonpress.org/

14 Likes

This is a super awesome and valuable tool, thanks for the work! Getting a 10x size reduction with basically no visible difference is huge :smiley:

2 Likes

I’ll add later the ability to tune the comparison threshold and to use altColor for dark areas.
Meahwhile there is the great breakthrough in the new release: KTX2 texture conversion.

To use KTX2 texture conversion just choose “ktx2” (currently) option in the “Texture Format” drop button.

Currently there are no settings (some will be added soon), UASTC mode is used (ETC1S support is coming).
Be aware that KTX2 compression takes time (usually 5-30 seconds for one average texture) so meanwhile you may entertain yourself with console messages giving some debug information.

To speed up the process one may choose to resize texture first. Use the “Select Resize” button, then press ‘R’ to reload the model.

The original and optimized VRAMs (GPU memory used by textures) are shown at the top info panel.

4 Likes

Keep em coming @labris !!!

1 Like

Added 2 more modes to KTX2 texture conversion, so there are 3 of them at the moment: ktx2/UASTC, ktx2/ETC1S and ktx2/MIX.

In the MIX mode albedo (baseColor) textures are processed with ETC1S, textures from all other channels are compressed with UASTC. This is the best combination of visual quality, file size and GPU size (VRAM). More modes will follow, meanwhile one may try to tune some compression settings like described further.

There are several settings available at the KTX2 Compression panel. To open it, use the Settings button.

ETC1S Quality Level allows you to choose between file size and quality. Range: 1-255.

ETC1S Compression Level parameter controls the encoder performance vs. file size tradeoff. When set to 0 it works really fast. Range: 0-5.

Both above mentioned settings are applied only to ETC1S compression (and work in MIX mode for ETC1S textures as well).

Also one may choose to use or not to use UASTC Zstandard Supercompression. When checked (by default) it may save some file size but will take some CPU time to zstd decompress (very fast) the texture before sending to GPU.
This setting applies only to UASTC compression (and works in MIX mode for UASTC textures as well).

Note that the pure UASTC compression may sometimes lead to the file size bigger than the original size, but GPU size (VRAM) will always be much less than original one.

Since KTX2 conversion takes time one may optimize geometry first with No Resize and Keep Original texture settings for better comparison (press ‘R’ after any parameter change to reload the file with the new parameters appiled) and then choose the Texture Format and play with KTX2 Compression settings.

@PirateJC I believe we could update the KTX tools documentation section now - KTX2 Compressed Textures | Babylon.js Documentation

2 Likes

GO GO GO !!! :slight_smile:

1 Like

Added the ability to drop OBJ+MTL+textures files for geometry and texture optimization.

The screenshot comparison has no sense here because of different nature of materials used (user will receive the corresponding notification).

So now one may drop OBJ model set into https://glb.babylonpress.org/ and get optimized KTXed GLB :slight_smile:

2 Likes

It’s an extremely handy and quick tool, thank you!

Is there any way of controlling the webp compression level?
I’m asking because I have compression artefacts on the texture.

Cheers from Hamburg, Germany
doc

Not for browser version. If you want full control use GLTF-Transform CLI. Install the sharp module, and provide an encoder. When the encoder is omitted — sharp works only in Node.js — the implementation will use a platform-specific fallback encoder, and most quality- and compression-related options are ignored, sadly :slight_smile:

First make sure that you don’t resize it.
I would also recommend to try ktx2/MIX mode where albedo textures are processed with ETC1S (smaller size) and all other texture with UASTC (better quality).


You may also try some other texture format/compressions combinations, here is quite a good guide - 3D-Formats-Guidelines/KTXArtistGuide.md at main · KhronosGroup/3D-Formats-Guidelines · GitHub

I’m getting this weird page when I enter the URL, did something happen?

Should work now, I forgot to pay for my hosting :slight_smile:

3 Likes