Compress a VRML file with draco loader without loader.setDRACOLoader()

I’m trying to convert a VRML wrl file with the DRACOLoader and wonder why the function: loader.setDRACOLoader() is not recognized by the browser loader.setDRACOLoader is not a function and not mentioned in the doc so I have a feeling this method is deprecated…

What is the new method of loading optimizing and compressing .wrl models?, I guess similar to the editor example?

VRMLLoader never supported setDRACOLoader(). That method only exists from GLTFLoader.

VRML has no built-in DRACO support. If you want a compressed asset, import WRL assets via VRMLLoader and then export to glTF via GLTFExporter. You can then use tools like gltf-transform to optimize the asset.

Yeah but then there’s this dude pretending the viewers know it’s know a build in function as it blender in with his other code making it seem native untill you try and come across problems also altough blender might be good for very very heavy model project compression and optimization(as when I use it I manage to compress the original models ~6 times their original size) I’m looking for a native in browser with threejs solution for the import and optimization.

So you say the procedure is to import the model as wrl into threejs then convert it to .glb then use gltf-transform to convert and export the model to an optimized .glb model to then finally display the model to the user?

Is there a simple implementation of such a thing for html threejs as it seem quite a common thing to do?

To clarify: GLTFExporter can’t export with DRACO compression so if you want an optimized model, you have to perform a separate step after the export.

You could of course import the VRML file in Blender and then export to glTF which supports DRACO compression.

There is no out-of-the box solution meaning you have to wire up all components by yourself. Meaning VRMLLoader, GLTFExporter and gltf-transform.

Yeah, isn’t there an example that compresses save’s the gltf-transform compressed model in a buffer folder for “later visit” and loads and displays the compressed model with threejs?

(and ofcourse auto check that it doesn’t export and compress “after refresh” for fast loading speeds)

Just asking out of lazyness if gltf-transform works in .js I’ll put some work into it and and probably will be able to get it done, but if someone else made it, why make it twice?

There is no official example for THREE.GLTFExporter + glTF Transform, but you can find guidance on how to implement it in this thread:

Just to clarify, you should store the compressed file on your server. There would be little point in having a visitor to your site download the uncompressed file and then compress it, as it then needs to be decompressed before rendering. The compressed data should be what is initially sent over the network. So, most people do this compression offline, and not on a client device.

2 Likes