CesiumGS / cdb-to-3dtiles

Convert CDB to 3D Tiles
Apache License 2.0
76 stars 28 forks source link

EXT_feature_metadata buffers are not 8-byte aligned #64

Open nithinp7 opened 2 years ago

nithinp7 commented 2 years ago

This pertains specifically to #58

I ran into this issue with a cdb-to-3dtiles-next tileset, it seems like sometimes the metadata buffers aren't 8-byte aligned (as the extension spec prescribes). I briefly looked through the cdb-to-3dtiles code and I didn't catch any 8-byte alignment of the metadata buffers, so that seemed to confirm my understanding.

Again I looked only briefly at the code here; the issue may be a bad implementation on my end or a misunderstanding of the spec even, feel free to close this if that is the case!

@sanjeetsuhag

sanjeetsuhag commented 2 years ago

Do you know which type of GLBs are affected? Is the GSModels or the GTModels?

nithinp7 commented 2 years ago

I've noticed it with Elevation and GSModels glbs. GTModels are not completely supported yet in cesium-native (at least the instanced ones) so those may secretly have the same issue too even though it's hidden for now.

nithinp7 commented 2 years ago

I'm not sure if it's related, but I'm going to retile with this branch I opened a while ago just to check: https://github.com/CesiumGS/cdb-to-3dtiles/pull/62.

sanjeetsuhag commented 2 years ago

@nithinp7 Did retiling on that branch help resolve your issue?

nithinp7 commented 2 years ago

@sanjeetsuhag I finally got around to retiling again with the branch, the issue seems to still remain. I had to comment out our alignment validation check to get EXT_feature_metadata buffers to work.

nithinp7 commented 2 years ago

I think the issue is here: https://github.com/CesiumGS/cdb-to-3dtiles/blob/4fbb27dd1a3322b0274e3694658896d80f2de371/CDBTo3DTiles/src/Gltf.cpp#L529

All metadata buffers are just tacked onto the end of the 0th buffer, with no padding.