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

DRACOLoader: use decoder from gstatic by default #27263

Closed
JL-Vidinoti opened this issue Nov 28, 2023 · 3 comments
Closed

DRACOLoader: use decoder from gstatic by default #27263

JL-Vidinoti opened this issue Nov 28, 2023 · 3 comments

Comments

@JL-Vidinoti
Copy link

Description

The DRACOLoader requires to set the decoder path using setDecoderPath.
The documentation gives the following usage example:

const loader = new DRACOLoader();

// Specify path to a folder containing WASM/JS decoding libraries.
loader.setDecoderPath( '/examples/jsm/libs/draco/' );

However, it is not always very convenient to provide the decoder path because the decoder files need to be hosted somewhere. Providing explicitly the decoder path may be optional.

Solution

The draco team recommends using the decoders hosted on www.gstatic.com (see README file at https://github.com/google/draco/tree/master).
For instance, the current draco decoders are available at https://www.gstatic.com/draco/versioned/decoders/1.5.6/

I suggest that the DRACOLoader uses this URL by default if a decoder path is not explicitly set using setDecoderPath.

Alternatives

As a three.js developer, we can simply set the decoder path using dracoLoader.setDecoderPath( "https://www.gstatic.com/draco/versioned/decoders/1.5.6/");
But it is hard to keep track of the draco version when updating three.js to a new version.

Additional context

No response

@mrdoob
Copy link
Owner

mrdoob commented Nov 28, 2023

Considering that we're slowly introducing examples that import directly from https://unpkg.com/... makes sense to also load the daco library from gstatic.

@donmccurdy What do you think?

@mrdoob mrdoob added this to the r??? milestone Nov 28, 2023
@donmccurdy
Copy link
Collaborator

donmccurdy commented Nov 28, 2023

I am OK with doing this for examples.

Personally though, I would not recommend relying on CDNs for production software – I don't agree with the Draco team's advice about that. Gstatic is more reliable than Unpkg, yes, but even on Gstatic, updates sometimes break: google/draco#751. If reliability is important, it is better to deploy the decoders with your application, so that you know when updates are happening and have the opportunity to test them.

@donmccurdy
Copy link
Collaborator

I don't feel strongly that action is needed here. I do have some misgivings about loading WASM resources from third-party CDNs as a default behavior, which our users would need to discover and opt-out if they don't want. Closing for now, but willing to discuss more if others disagree.

@donmccurdy donmccurdy closed this as not planned Won't fix, can't repro, duplicate, stale Apr 7, 2024
@mrdoob mrdoob removed this from the r??? milestone Apr 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants