-
Notifications
You must be signed in to change notification settings - Fork 8
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
setMeshoptDecoder must be called before loading compressed files #13
Comments
I found out that the MeshoptDecoder from So you might need to try: gltf.setMeshoptDecoder(MeshoptDecoder()); https://github.com/mrdoob/three.js/blob/master/examples/jsm/libs/meshopt_decoder.module.js |
@Brakebein Nope( Same error |
Now, I see the problem: you are using this small utility function That's how it worked for me: import { GLTFLoader } from 'node-three-gltf';
import { MeshoptDecoder } from 'three-stdlib';
const loader = new GLTFLoader();
loader.setMeshoptDecoder(MeshoptDecoder());
loader.load('player-meshopt.glb', (gltf) => {
console.log(gltf);
}, null, (err) => {
console.error(err);
}); |
import { DRACOLoader, GLTFLoader } from "node-three-gltf";
import { type GLTF, MeshoptDecoder } from "three-stdlib";
export const loadGltf = async (url: string) => {
const loader = new GLTFLoader();
const draco = new DRACOLoader();
const meshopt = MeshoptDecoder();
loader.setDRACOLoader(draco);
loader.setMeshoptDecoder(meshopt);
const gltf = await loader.loadAsync(url);
return gltf as GLTF;
}; Worked as well. Big thanks, @Brakebein |
It may be worth nothing that |
Well, the readme states that it instantiates GLTFLoader and DRACOLoader, but doesn't mention anything else.
Fact is that I only worked with draco-compressed gltf files so far, I haven't done yet anything with the MeshoptDecoder. So maybe, I will update the readme in this regard next time. |
results in
How can I load compressed gltfs?
The text was updated successfully, but these errors were encountered: