Dracoloader takes more time

I have compressed model using gltf-pipeline and compressed model is in .glb format. Using Dracoloader and GLTFloader to load the .glb. Its taking more time to load.
Any suggesting for reducing the time taken to load

How is the parsing time when drag/drop the asset into the three.js editor?

It’s important to distinct between the transmission time (the time that is required to transmit the asset over the network) and the actual parsing time (the time that is required to decompress the asset and create three.js objects from it).

1 Like

In three.js editor Its quick. But same model is loaded Using GLTFLoader
Using below code

const modelPath = `${this.MODEL_FOLDER_PATH}/${modelName}.glb`;
const dracoLoader = new DRACOLoader();
dracoLoader.setDecoderPath(this.DRACO_DECODER_PATH);
dracoLoader.setDecoderConfig({ type: "js" }); 
dracoLoader.preload();
const loader = new GLTFLoader();
loader.setDRACOLoader(dracoLoader);
return new Promise(resolve => {
  loader.load(modelPath,
	(gltf: any) => {
	  console.log(gltf)
	}
  );
});

Try to remove this line so the loader makes use of Web Assembly.

Draco (or compression in general) is generally going to be trading off file size vs. decoding time. If the file was 100 MB originally, it’s going to take a long time to download over a network. Downloading a 95x smaller file, and spending a little time decoding it, could be much faster and so your users see the scene sooner.

We can’t have it both ways, so I’d encourage you to share any details that might help us narrow down the right tradeoffs for your project. The file, the decoding times you’re seeing, whether you care about time to first paint vs. not dropping any frames in an application that’s already running, etc.

Also — Meshopt compression decodes much faster. Combine it with gzip and you can get pretty similar compression numbers to Draco. This is often a good tradeoff. I’d start with gltfpack if you want to explore that option.

3 Likes

HI Thanks This helped, This saves almost 2 seconds

1 Like