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.45k stars 961 forks source link

certain files encoded with 1.3.6 cannot be decoded with 1.4.1 #704

Open willemkokke opened 3 years ago

willemkokke commented 3 years ago

I encountered this issue in draco files produced by a third party application (R3DS Wrap), however I've reproduced it exclusively using version 1.3.6 and 1.4.1 of the draco releases.

Basically, if I encode a OBJ file with 1.3.6 and use quantization parameters higher than 25, the resulting draco fails to be able to be decoded and fails with "Failed to decode the input file Failed to decode point attributes."

I have not observed any obj file dependent behaviour.

C:\Users\willem\Downloads\draco>draco_encoder1.3.6.exe -i test.obj -qp 30 -qn 30 -qt 30 -qg 30 -cl 7 -o test.drc

Encoder options:
  Compression level = 7
  Positions: Quantization = 30 bits
  Texture coordinates: Quantization = 30 bits
  Generic: Quantization = 30 bits

Encoded mesh saved to test.drc (14995 ms to encode).

Encoded size = 55393010 bytes

For better compression, increase the compression level up to '-cl 10' .

C:\Users\willem\Downloads\draco>draco_decoder1.3.6.exe -i test.drc
Decoded geometry saved to test.drc.ply (3592 ms to decode)

C:\Users\willem\Downloads\draco>draco_decoder1.4.1.exe -i test.drc
**Failed to decode the input file Failed to decode point attributes.**

C:\Users\willem\Downloads\draco>draco_encoder1.3.6.exe -i test.obj -qp 24 -qn 24 -qt 24 -qg 24 -cl 7 -o test.drc

Encoder options:
  Compression level = 7
  Positions: Quantization = 24 bits
  Texture coordinates: Quantization = 24 bits
  Generic: Quantization = 24 bits

Encoded mesh saved to test.drc (10717 ms to encode).

Encoded size = 28301225 bytes

For better compression, increase the compression level up to '-cl 10' .

C:\Users\willem\Downloads\draco>draco_decoder1.3.6.exe -i test.drc
Decoded geometry saved to test.drc.ply (3166 ms to decode)

C:\Users\willem\Downloads\draco>draco_decoder1.4.1.exe -i test.drc
Decoded geometry saved to test.drc.ply (3225 ms to decode)
willemkokke commented 3 years ago

I've tried the same using the 1.4.1 encoder. I didn't expect the 1.3.6 decoder to be able to decode it if there had been a change in the bitstream format, but the 1.4.1 decoder also fails on it.

Reducing the quantization parameters to 24 allows both version of the decoders to read the file again.

(R3DS Wrap uses 30 as a default value for the position, texture and normal quantization parameters, so these files exist in the wild. R3DS Wrap can also read files that it produces with those default parameters, which 1.3.6 can but 1.4.1 can't)

C:\Users\willem\Downloads\draco>draco_encoder1.4.1.exe -i test.obj -qp 30 -qn 30 -qt 30 -qg 30 -cl 7 -o test.drc

Encoder options:
  Compression level = 7
  Positions: Quantization = 30 bits
  Texture coordinates: Quantization = 30 bits
  Generic: Quantization = 30 bits

Encoded mesh saved to test.drc (14619 ms to encode).

Encoded size = 55392106 bytes

For better compression, increase the compression level up to '-cl 10' .

C:\Users\willem\Downloads\draco>draco_decoder1.3.6.exe -i test.drc
Failed to decode the input file Failed to decode point attributes.

C:\Users\willem\Downloads\draco>draco_decoder1.4.1.exe -i test.drc
**Failed to decode the input file Failed to decode point attributes.**

C:\Users\willem\Downloads\draco>draco_encoder1.4.1.exe -i test.obj -qp 24 -qn 24 -qt 24 -qg 24 -cl 7 -o test.drc

Encoder options:
  Compression level = 7
  Positions: Quantization = 24 bits
  Texture coordinates: Quantization = 24 bits
  Generic: Quantization = 24 bits

Encoded mesh saved to test.drc (10706 ms to encode).

Encoded size = 28301225 bytes

For better compression, increase the compression level up to '-cl 10' .

C:\Users\willem\Downloads\draco>draco_decoder1.3.6.exe -i test.drc
Decoded geometry saved to test.drc.ply (3211 ms to decode)

C:\Users\willem\Downloads\draco>draco_decoder1.4.1.exe -i test.drc
Decoded geometry saved to test.drc.ply (3265 ms to decode)