KhronosGroup / glTF

glTF – Runtime 3D Asset Delivery
Other
7.12k stars 1.13k forks source link

Standard compression on binary buffers. #1834

Open vpenades opened 4 years ago

vpenades commented 4 years ago

Draco is great and all, but admitedly, it's not widely supported, few engines, and very few exporters do support Draco compression.

In fact, 99% of models you can find in the wild are uncompressed just because that.

I know the ideal solution would be for everybody to support Draco by default... but being realistic this is not going to happen in the long run, which means that uncompressed glTFs are the de-facto standard.

So for the sake of provinding a solution to the other 99% of models in the wild, I would like to ask if the community would accept adding an extension that would allow compressing the binary buffers to some widely known compression algorythm, deflate, gzip, lz4, whatever... such extension would be very easy to implement by most developers, compared to implementing Draco.

donmccurdy commented 4 years ago

I know the ideal solution would be for everybody to support Draco by default.

I might disagree with this point, actually. Draco is a useful optimization in many cases, but I don't think having it on by default would necessarily be a good thing. glTF-Pipeline is available to compress the output from any exporter. The main WebGL engines do support Draco. I'm less familiar with native engines, but I'm skeptical that they would want this type of compression for a model unless it's being transmitted over the network (is that common?).

But the rest of your comment holds up even without that, so here are a few more thoughts:

gzip: 100% of WebGL engines support file-level gzip for glTF models already — web browsers detect and decode it automatically, without pausing the page's JavaScript execution. Some webservers can also automatically compress models when they serve, although (more often) webservers don't know about new file extensions like .gltf or .glb, and so the user needs to gzip the files in advance. See https://github.community/t/support-for-gzip-on-glb-3d-model-files/11004 for my request for GitHub Pages to add glTF to its list of gzip-supported formats. This is the default choice for web applications, even outside of 3D & WebGL — we gzip everything, including our application code. And as an added benefit this compresses the JSON portion of the glTF file, too.

buffer-level compression: Have you looked at the EXT_meshopt_compression proposal yet? There's a lot more context about it in https://github.com/KhronosGroup/glTF/pull/1702. It's not a widely-known compression algorithm, but it complements file-level gzip compression quite well.

vpenades commented 4 years ago

If a compresión extensión is intended to succeed, it must be dead easy to implement, which means it must be available for all languages out of the box, otherwise it will be yet another niche compression.. Gzip is a good candidate indeed.