How to create a .drc (DRACO compressed) file

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 );
2 Likes