Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Update DRACOLoader documentation to recommend reusing a loader instance #20973

Merged
merged 1 commit into from
Dec 31, 2020

Conversation

gkjohnson
Copy link
Collaborator

Related issue: --

Description

I've gotten into the habit of creating a new Loader (GLTF, OBJ, DAE, etc) for every model I want to load because once you've started to load a model you can't modify the options. However when working on the 3DTilesRenderer project I noticed that every time a tile with DRACO compression was being loaded it would download and create a new DRACO decoder instance resulting in extremely slow parsing and out of memory errors. I fixed this by reusing a single DRACOLoader instance which I think is outside of the typical use for loaders so I thought it should be documented. I expected that once the first DRACOLoader downloaded an instance of the decoder data it would not need to try again to load it from the same url but that doesn't seem to be the case.

You can see the behavior in this jsfiddle that creates a new DRACOLoader to load a DRACO GLTF file and 1 second later does the same thing. In the Network tab you can see it downloads the WASM and JS wrapper twice:

https://jsfiddle.net/qe85wdmu/

cc @donmccurdy

@mrdoob mrdoob added this to the r125 milestone Dec 31, 2020
@mrdoob mrdoob merged commit 15e9721 into mrdoob:dev Dec 31, 2020
@mrdoob
Copy link
Owner

mrdoob commented Dec 31, 2020

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants