How to create a .drc (DRACO compressed) file

Hi, I dont quite understand how to work with draco compression.

  • When I export a model with Blender, the gltf exporter offers a “compression” option to export draco-compressed .gltf files.
  • However, looking at threejs documentation, it seems that a .drc file is expected by three DRACOLoader.

So my first question is: are we supposed to convert draco-compressed .gltf files to .drc files ? Or should we convert a standard .gltf file to a .drc file using something like gltf-pipeline ?

Besides, whatever I try (draco compressed .gltf files, standard .gltf files converted to .drc files using the gltf-pipeline tool, various export options, …), I keep getting the error “THREE.DRACOLoader: Unexpected geometry type. at decodeGeometry” when I try to load a file with threejs DRACOLoader.
However when I try loading the bunny.drc file from the threejs example it works perfectly.

I feel like I’m missing something, any help would be appreciated!

Draco is a mesh compression library, and can be used in several file formats. The library includes a default .drc format (which is what you’d use DRACOLoader for) but usually you won’t want to use that — it’s limited to just mesh data and can’t include materials, animations, textures, or other things people commonly want from a 3D file format.

Instead the most common thing is to start with a glTF file, then apply Draco compression to the mesh data in that file. At the end you still have a glTF file (which can include materials, animations, etc.), and need to use GLTFloader to read it. There’s a short example in the GLTFLoader documentation showing how to install the DRACO decoder. Or the webgl / animation / keyframes example also shows this.

const dracoLoader = new DRACOLoader();
dracoLoader.setDecoderPath( 'js/libs/draco/gltf/' );

const loader = new GLTFLoader();
loader.setDRACOLoader( dracoLoader );
loader.load( 'path/to/model.glb', function ( gltf ) {

  // ...

}, undefined, console.error );
1 Like