Draco mesh compression blog post

Gabby’s latest blog post explains how Draco mesh compression in Cesium takes advantage of Web Workers for parallel decompression and performs dequantization on the GPU for faster streaming and memory savings.

https://cesium.com/blog/2018/04/09/draco-compression/

Hı ,

Is there a sample code for 3d tile?

11 Nisan 2018 Çarşamba 22:52:47 UTC+3 tarihinde Sarah Chow yazdı:

Hi Selahattin,

You would process your 3D tileset with Draco compressed glTF 2.0 tiles, then load it in Cesium as usual.

Thanks,

Gabby

Hi Gabby, would it be possible for the Draco-compressed CityGML set thats featured on the blog post video to be made public so we can see what this really feels like performance wise? That would be very helpful to determine if its something users want to spend time on replicating for their own model collections.

Thanks,
Greg

Hi Greg,

It will be available with Cesium ion on May 1st!

Thanks,

Gabby

Thanks Gabby for the blog.

I’ve downloaded the branch and am giving it a try. But I couldn’t make it work. Here is what I’ve been doing and it’d be great if you could give me some help on that.

I’m using the MilkTruck gltf model from this: https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/CesiumMilkTruck/glTF, and using the example command line. However, no output file was generated.

One thing I noticed was when I tried to open the MilkTruck model, Cesium (and other gltf viewers) said there was an “unexpected token in JSON at position 6”. Would that be something causing the tool not able to compress the model (there was no error messages during compression)?

Ultimately I’d like to do this on the 3DTiles that we have (multiple cities, several hundred MBs each). All those tiles are generated using FME and are in .d3dm extension. I’m not familiar with these formats and I’m having a hard time understanding glTF and b3dm, and which tool is compatible with which… any learning materials would be highly appreciated!

Thanks again!

-victor

Hi Victor,

Sounds like the glTF json is malformed.

Try this PR instead: https://github.com/AnalyticalGraphicsInc/gltf-pipeline/pull/353, I think I may have linked incorrectly. If that works for you, I’ll update the link in the blog post!

Thanks,

Gabby

Thank Gabby.

I know this forum is not for learning git, but I’m not at all familiar with Pull Requests and am having a hard time getting the files from the link. For a branch I can pick the branch I wanted from the creator’s code list and download the whole zip file, but not for PRs. Am I missing something, or would it be possible to make the zip file directly available?

I still think that there might also be some problems with the MilkTruck model. Could you run your code on its gltf to see if the compression works on your end?

-victor

So I did some searches and managed to download the PR #353. For those who have the same struggle as me, the way to do so is to click the username just under the title of the pull number in the GitHub webpage. This will bring you to the repository of the location of the pull request. Then find the correct branch in the drop down menu.

Back to the pipeline. The PR #353 does work. It takes in a .glb file and output another .glb file, while showing the time of compression. The pipeline in the blog does not work and does not generate any file (no time of compression time shown either). I used a simple 3D model I created (OpenBox.glb). It’s a red box and has an open animation embedded (side note, since Cesium 1.43 the animation stopped working, any reason why?). Interestingly the file size increases instead of decreases after the compression (9.78K -> 10.8K).

Because of that I think the Milk Truck file (and Buggy file) linked in the blog are malformed or corrupted. Please fix.

Gabby: let me know if there’s any update. And as mentioned my plan is to compress 3DTiles, which are typically a .json file along with a set of .b3dm files. Will the pipeline work on that format and structure? And will this be automated once the ion is available in May 1?

Thanks.

-victor

OpenBox.glb (9.79 KB)

So I did some searches and managed to download the PR #353. For those who have the same struggle as me, the way to do so is to click the username just under the title of the pull number in the GitHub webpage. This will bring you to the repository of the location of the pull request. Then find the correct branch in the drop down menu.

Yes, that’s one way to grab the code, you can also clone the repo and checkout that branch.

The PR #353 does work. It takes in a .glb file and output another .glb file, while showing the time of compression.

Good, I will update the link.

Interestingly the file size increases instead of decreases after the compression (9.78K → 10.8K)

You may need to try different levels of compression. What is the command you ran?

Because of that I think the Milk Truck file (and Buggy file) linked in the blog are malformed or corrupted. Please fix.

I don’t believe these are corrupted at all, I am able to load them in Cesium, and they can also be loaded in Three.js and BabylonJS.

since Cesium 1.43 the animation stopped working, any reason why?

We chose not to animate by default, you can still hit the play button or turn it on in your app. (CHANGES.md is a great resource to see what has changed between releases.)

And as mentioned my plan is to compress 3DTiles, which are typically a .json file along with a set of .b3dm files. Will the pipeline work on that format and structure? And will this be automated once the ion is available in May 1?

Our 3D tiling pipeline can embed a draco compressed gltf in the b3dm files. We’re not including 3D Tiling tools with the release on May 1st, but you can contact us to get your data tiled with our pipeline.

Thanks Gabby for the reply.

I was using the example command provided in the PR #2 for the Draco compression extension (replacing the duck model with the box model):

node ./bin/gltf-pipeline.js -i ./specs/data/Duck/glTF/Duck.gltf -d --draco.quantizePosition=10 --draco.quantizeNormal=8 --draco.quantizeTexcoord=8 --draco.quantizeColor=6 --draco.quantize Skin=12 -s -o Duck.gltf

``

Regarding the MilkTruck files (gltf, bin, png), I got them using this link (as shown in the blog):

https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/CesiumMilkTruck/glTF

I could not load it in Cesium 1.44, which throws an error saying something like this: t {name: “RuntimeError”, message: “Failed to load model: [object Object]↵Unexpected token < in JSON at position 6” …

This plus the fact that the PR #353 works on my box model but not the MilkTruck model makes me think there really is a problem with the MilklTruck files. Are we using the same files?

And yes you are absolutely correct about the animation! Just enabled the animation when declaring the viewer object and now the box is animating.

I’ve tried contacting since Feb (emailed Tim) regarding the 3D Tiles Pioneers program and got no reply. Request to beta-test ion also yields zero response… Is there another way I can contact you fellows?

-victor

Your error message: “Unexpected token < in JSON at position 6” sounds like you’re trying to load the HTML GitHub webpage instead of the actual JSON file. You should be able to open up the glTF file in a text editor and confirm that it’s valid JSON and looks like this: https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0/CesiumMilkTruck/glTF/CesiumMilkTruck.gltf

You are absolutely correct, Scott! I just right-clicked and “save link as…”, and apparently it does what you described. It’s all fixed now. Thanks! -victor

Hi Victor,

Glad you got the Milk Truck loading (thanks Scott!), and the box animating.

For 3D Tiles, we’re planning on rolling out ion in a week, on May 1st, so getting a beta invite may be moot at this point. Try todd@agi.com as well.

Thanks,

Gabby

Hi,

First of all: nice blog post, I’ll keep the parallel decompression and dequantization techniques in mind when adding Draco support to my own loader/viewer (gltf-loader-ts / webgl-operate examples).

Second, I’ve noticed some inaccuracies in the section about the Buggy model - I’ve got the sample models repo checked out and the sizes are quite different on my disk:

Buggy.gltf: uncompressed 384KB (not 21.7KB), compressed 288KB (not 18.5KB)

Buggy0.bin uncompressed 7.7MB (not 17.4MB), compressed 844KB

Also, the text below the images talks about MB instead of KB (“18.5 MB vs. 21.7 MB”).

Regards,
Benjamin Wasty

Hi Benjamin,

Thanks, you are correct. I will update the post accordingly!

Thanks,

Gabby

Hi Gabby, Do you have more updates on Draco Compression? Any reference Link, I tried to set it up from github, but I see prerequisites are missing from that documentation, make command throws several errors. Do you have any other documentation for specific implementation for Draco Compression Technique.
Also I hope it does work, 3D tiles (b3dm files).

If you upload your data to Cesium ion (cesium.com/ion) the produced 3D Tiles should automatically be compressed with Draco.