CesiumGS / gltf-pipeline

Content pipeline tools for optimizing glTF assets. :globe_with_meridians:
Apache License 2.0
1.87k stars 241 forks source link

Draco compression for points #626

Closed ebeaufay closed 1 year ago

ebeaufay commented 1 year ago

Hi,

I tried to draco compress a point cloud in a glb file but the output files where the same size.

Looking into the library I see that primitive mode must be WebGLConstants.TRIANGLES but by forcing the code to accept WebGLConstants.POINTS, I managed to draco compress the file and it is readable, at least in three.js.

Would you consider allowing points to be processed by default or are there some other considerations I'm not aware of?

The line I changed to make draco compression work for points is : lib/compressDracoMeshes:146

lilleyse commented 1 year ago

Hi @ebeaufay, it's a restriction of the extension: https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_draco_mesh_compression/README.md#restrictions-on-geometry-type

When using this extension, the mode of primitive must be either TRIANGLES or TRIANGLE_STRIP and the mesh data will be decoded accordingly.

ebeaufay commented 1 year ago

I see thanks for checking this out, I should have checked myself.

Both cesium and threejs load draco compressed points fine even if it's non standard. It seems it would just be a matter of extending the spec.

lilleyse commented 1 year ago

I wrote up an issue for extending the spec a while back: https://github.com/KhronosGroup/glTF/issues/1809

It hasn't gained much traction but good to see that there's some interest.