# Draco encoder lossless, is it possible?

I'm trying to use the draco library in a Unity project. I've a lot of obj files with models of a person in different positions. When I encode these models with the draco_encoder command I obtain a lossy conversion, and a lot of parts of my original models get lost.

I tried to play around the parameters -qp and -cl in order to change the quantization and the compression level, but also with qp at its maximum and cl to its minimum some parts get lost.

In this image the left model is the original one. The right model is the one converted with draco_encoder by using cl 0 and qp 21. As you can see some parts are missing.

Do you have any suggestion on how can I obtain a lossless (as lossless as possible) conversion?

• Doe the draco library documentation say anything about it? Does it claim the compression is lossless or not? It's also worth mentioning in the beginning a few things about that library, so people unfamiliar with it can better understand the question. Sep 4 '19 at 14:56
• Have you tried another method of compressions, like converting to vertex buffer and a applying generic compressor? Sep 4 '19 at 14:58
• I don't see any lossless option. But my research is not conclusive, so I can't really add more than a comment to this.
– Almo
Sep 4 '19 at 15:20

The documentation for encoding states:

A value of 0 for the quantization parameter will not perform any quantization on the specified attribute. Any value other than 0 will quantize the input values for the specified attribute to that number of bits.
...
In general, the more you quantize your attributes the better compression rate you will get. It is up to your project to decide how much deviation it will tolerate. In general, most projects can set quantization values of about 14 without any noticeable difference in quality.

That is the key section to note because quantization:

is a lossy compression technique achieved by compressing a range of values to a single quantum value. When the number of discrete symbols in a given stream is reduced, the stream becomes more compressible.

In your example, you're using a qp factor of 21; the docs say quality begins to change noticeably at around a qp of 14, so it's not surprising that you're seeing errors. If you want to reduce the lossiness, you need to reduce your qp value. Theoretically, a qp of 0 would give you lossless compression. You may need to increase the compression level cl to compensate.

That being said, most lossy compression techniques need to discard some data in order to achieve any compression at all. It's possible that reducing the qp to zero will prevent compression errors, but increase the over size of the data set once encoded.

• Indeed it always discard a lot of vertices... As far as I understand it, unfortunatelly draco doesn't allow a lossless compression... Sep 9 '19 at 7:03