google / draco

Draco is a library for compressing and decompressing 3D geometric meshes and point clouds. It is intended to improve the storage and transmission of 3D graphics.
https://google.github.io/draco/
Apache License 2.0
6.53k stars 966 forks source link

How n-polygons are compressed and why only triangle meshes are created during decompression #459

Closed jeckgit closed 4 years ago

jeckgit commented 6 years ago

Hello, I was wondering how the compression algorithm and the decompression algorithm work. With Draco, n-polygonal meshes can be compressed. However, only triangle meshes are created during decompression. I assumed that the algorithm "Geometry Prediction for High Degree Polygons" presented by Isenburg was used for compressing, because I repeatedly came across the parallelogram prediction inside the source code. From the source code I also found that the "Edgebreaker" algorithm was used, which in turn can only compress triangle meshes.

My question is, how are n-polygonal meshes compressed or how are the triangle meshes finally created by decompression?

imhuwq commented 6 years ago

I think there are two layers of compression in the Draco lib:

ondys commented 5 years ago

Draco works only on triangular meshes. For some cases (e.g. obj files) the n-polygons are triangulated during mesh loading, but they are not preserved during compression. One way to preserve general polygons is to use generic attributes that store what edges are "internal". To see how that could be used check code used in the Draco USD plugin: https://github.com/PixarAnimationStudios/USD/pull/761