glTF files compressed with gltfpack do not work

When I compress them normally they are not shown in the scene. I get no errors but they are not shown. When I disable KHR during compression they are working properly.
Could this be a fault of Three.js or gltfpack?
I am using Three.js r115.

Thanks a lot.

See https://github.com/zeux/meshoptimizer/tree/master/gltf#usage. If you are enabling the compression options on gltfpack, you have to use its custom version of GLTFLoader.

When I disable KHR disable KHR during compression they are working properly.

What gltfpack option are you referring to?

I am not using the -c option so I guess the three.js version of GLTFLoader should work.
I am referring to the -noq option.
Everything works properly after the compression when I use the -noq option. The problem appears when I use the defaults of gltfpack.

Hm, is it still broken when viewing the model in gltf-viewer.donmccurdy.com/ or https://sandbox.babylonjs.com/? If so I would suggest filing an issue on gltfpack. If not, I may need access to the model to look into it.

It works properly in the viewers. Here is the models before and after the compression.ball.gltf (193.8 KB) ball-after.bin (16.9 KB) ball-after.gltf (1.1 KB)

Sadly I don’t have the knowledge to look through the model and find the problem. Maybe there is a problem in Three.js?

Possibly the cause of this issue: https://github.com/mrdoob/three.js/pull/18913#issuecomment-627163261

If it’s working correctly in the viewer http://gltf-viewer.donmccurdy.com/, then it works in three.js — that viewer is built with three.js. Can you share your code for how you’re loading the model? Are you sure it works correctly before you compress it with gltfpack?

This is the function that loads the balls. I have also tried removing the draco loader but I noticed no difference.

  createBallMesh(loadingManager?) {
    const gltfLoader = new GLTFLoader(loadingManager);
    // Optional: Provide a DRACOLoader instance to decode compressed mesh data
    const dracoLoader = new DRACOLoader(loadingManager);
    (dracoLoader as any).setPath("three/examples/js/libs/draco");
    gltfLoader.setDRACOLoader(dracoLoader);
    gltfLoader.setPath("three/models/ball/");
    return new Promise((resolve, reject) => {
      gltfLoader.load("ball.gltf", gltf => {
        const ballScene = gltf.scene;
        gltf.scene.traverse(child => {
          if ((child as THREE.Mesh).isMesh) {
            const ballGeom = (child as THREE.Mesh).geometry;
            ballGeom.computeBoundingSphere();
            let ballMeshGeom: THREE.Geometry | THREE.BufferGeometry;
            child.traverse((child: THREE.Mesh) => {
              if ((child as THREE.Mesh).isMesh) {
                ballMeshGeom = (child as THREE.Mesh).geometry;
                resolve({ ballScene, ballGeom, ballMeshGeom });
              }
              if ((child as THREE.Object3D).isObject3D) {
                (child as THREE.Object3D).matrixAutoUpdate = false;
              }
            });
          }
        });
      });
    });
  }

Before the compression it loads properly and I didn’t notice any problem. We have used the model in our project and we had no problem.