How to create ktx2 correctly

Sure, this is the initial file @donmccurdy
shoes-low-poly.glb (2.8 MB)

If youā€™re looking at https://gltf-viewer.donmccurdy.com/, then the memory shown is based on performance.memory and JavaScript heap size ā€” it isnā€™t necessarily indicating GPU memory usage. Trying a few reloads here, there is a fair bit of variability on how much heap size is used when loading a model.

GPU memory is different, and itā€™s in GPU memory that the PNG or JPEG textures are typically decompressed. This can vary by device, but you can get an estimate from https://gltf.report or on the glTF Transform CLI:

Before:

# name uri slots instances mimeType compression resolution size gpuSizeĀ¹
0 Normal map-min normalTexture 1 image/jpeg 2048x2048 911.11 KB 22.37 MB
1 Base texture baseColorTexture 1 image/png 4096x4096 211.53 KB 89.48 MB
2 Roughness map-min metallicRoughnessTexture 1 image/jpeg 2048x2048 261.18 KB 22.37 MB

After:

# name uri slots instances mimeType compression resolution size gpuSizeĀ¹
0 Normal map-min normalTexture 1 image/ktx2 UASTC 2048x2048 3.53 MB 5.59 MB
1 Base texture baseColorTexture 1 image/ktx2 UASTC 4096x4096 366.58 KB 22.37 MB
2 Roughness map-min metallicRoughnessTexture 1 image/ktx2 UASTC 2048x2048 1.75 MB 5.59 MB

(scroll to the right if you canā€™t see the GPU memory column)

As you can see the GPU memory / VRAM usage is about 75% lower with UASTC, but neither of these files (alone) are likely to cause your device to run out of GPU memory.

Awesome clarification, far enough!

I will play around with some other params and check the results in gltf.report

Thank you

1 Like