@seanwasere in your website, can i ask how did you create draco compressed file for that monkey model?
is it that since my model is scanned model, i can’t compressed it into draco ?
I think i have tried and check most of the code and examples, i don’t think you have talked about way to reduce number of triangle from mesh.
in three.js i found simplifier but that works for model already loaded and it is not working in my case !!!
can you please help me learn what are the ways that i can compress my model without degrading it like draco degraded the original model.
is there anything that you prefer?
i want to focus all my learning and learn things on scanned 3d models, and in scanned 3d model, big problem is file size which i want to reduce but i am not able to find out what are the ways to do that.
I used blender. The monkey is a very simple model compared to yours.
Open blender,
click into main scene so that keyboard events are sent to it.
press a to select all.
press delete to delete all
press shifta to add a new mesh–>monkey
file – > export → gltf 2
open geometry options → tick Compression → Export
generating compressed from blender gives better model than the one that I got from gltf-pipeline module
but still there are some artifact which is not as bad as previous draco file which I mentioned in post.
@Pravin_Poudel try including the --draco.unifiedQuantization flag when compressing with gltf-pipeline. Draco compression involves rounding vertices to a grid (quantization). The default is to choose that grid independently for each mesh, which improves compression, but this may introduce seams between two adjacent meshes. The option above forces Draco to use the same grid for the whole scene, and should avoid the seams.
There area a lot of documented options in the CLI — I think you’ll want to try a few more of them. With unified quantization you may also need higher precision on the vertex positions. I’d recommend output to .glb rather than .gltf as well.
One important thing would be that the texture used by this model is almost 30 MB alone. Draco only compresses geometry, so you’ll need to do something else about that. Here’s a set of steps I’ve tried:
The result (attached) comes down to 11 MB with the steps above, and looks reasonably good to me. Further trial and error may improve results further. I’d also consider reducing the texture from 8K to 4K if mobile devices are a concern.
I did what you did but I didn’t do the first step because I was over excited to reduce my file size and the final file in glb that I got without compressing is 67MB
i am not able to understand why is this file size bigger than original gltf file which is 42 MB itself
No worries at all! Lots of moving pieces to optimize in a 3D model.
Since this model is Draco compressed does that mean I don’t need that texture anymore? because even when I deleted the texture there is no error.
You don’t need the texture anymore, but it isn’t because of Draco — in most tools, exporting to .glb (rather than .gltf) will embed textures and the binary .bin data into the self contained .glb. A .gltf usually keeps references to external files instead. And if you ever see a .gltf that doesn’t have external files (sometimes called “glTF Embedded”) that’s very inefficient (Base64 strings) and it’s better to switch to .glb (binary).
… is there any way I can run this command by the program because I want to reduce the file uploaded by users to my system ???
I guess it depends if you can execute CLI commands from your system? Or if not, what language your server is implemented in? glTF Transform is the most flexible of these tools in that area, it’s JavaScript and can do Draco compression in a web application or a node.js server without needing a CLI:
But the first step with gltfpack is important here, it joins the meshes together so they’ll compress better, and that part is only a CLI tool at this point. I have work in progress for supporting that feature in glTF Transform but it isn’t done yet.
but looks like to perform this, I have to clone this repo and install the dependency and run this file while giving input and output file name or location.
Is there any way I can do this in my project and have LOD in my model?
Either way is fine! Up to you. Getting the Draco encoder installed on the frontend is a little more complicated than in node.js, the Stack Overflow link above has some details on that.
I’m not sure if LODs will help for this particular model — that project is designed around the case where you have a large world with many objects, and want to make those objects more/less detailed as you get closer/farther away. For a single static room, it may not help much.
As far as the setup though, yeah I think it’s what the project readme describes. And you’ll also need to install extra plugins for THREE.GLTFLoader, which doesn’t support that extension out of the box. See GitHub - takahirox/three-gltf-extensions: Unofficial Three.js glTF loader/exporter plugins for that part, I’m not sure it’s completed, and using custom extensions are a more complicated topic.