KhronosGroup / glTF

glTF – Runtime 3D Asset Delivery
Other
7.16k stars 1.14k forks source link

How to compress gltf . files #2089

Open hmduc01 opened 2 years ago

hmduc01 commented 2 years ago

I use Substance Painter and Blender to save glb or gltf files, I see the advantage of compressing files with EXT_meshopt_compression , KHR_texture_basisu , KHR_draco_mesh_compression, so how do I use them to compress my glb file? , can anyone help me? . Thanks

donmccurdy commented 2 years ago

Hi @hmduc01 — If you're not sure which compression methods to use, you may want to share a link to your GLB file so that we can advise on that, and mention which viewer(s) you want to use the GLB file in. Some viewers may not support all compression methods.

gltfpack CLI or https://rapidcompact.com/ are excellent all-in-one compression tools. For more specific compression tasks you may find https://gltf-transform.donmccurdy.com/cli.html helpful.

The "quickest" thing (if you'd rather not use a CLI tool) would be to open a model in https://gltf.report/, select a compression option in the right hand panel, and export. But this doesn't yet support Basis/KTX2 compression, and may not optimize as exhaustively as gltfpack or rapidcompact.


Aside: It'd be helpful if https://github.khronos.org/glTF-Project-Explorer/ had some way to search for projects that (1) export to glTF, and (2) support particular extensions. I wonder if that's something we could add?

hmduc01 commented 2 years ago

Thanks @donmccurdy I just found Gltfpack, it has many nice features but I am a 3d artist so i know almost nothing about programming. I downloaded the gltfpack.exe file but don't know how to use it, I installed it like any other software. I have to use it in visual studio code software? . do you have any instructions on how to install and use this software?

donmccurdy commented 2 years ago

It's a commandline tool, so you'll need to open a terminal to use it. Nearly all operating systems come with a terminal built in, but you may need to find a tutorial (e.g. "How to use command line on \") to understand how to get into the right folder and execute gltfpack.exe. If you're not comfortable with that, software like RapidCompact – which doesn't require coding or a command line — would be easier to use, and has a free tier.

antonyadhiban commented 8 months ago

Shamless plug here.

Try https://optimizeglb.com Can compress upto ~90%.

Based on @donmccurdy s work gltf-transform.dev.