Options for Document.transform to prevent empty node removal #1050
Replies: 3 comments 1 reply
-
Hi @ReedCopsey — What's happening here is that Draco depends on having indexed geometry. The I think we can fix all that to not cause the issue, yes. In the meantime, if you know your geometry is already indexed, you can run a simplified version of the Draco transform: import { KHRDracoMeshCompression } from '@gltf-transform/extensions';
const dracoBasic = () => {
return (document) => {
document
.createExtension(KHRDracoMeshCompression)
.setRequired(true)
};
};
await document.transform(dracoBasic()); |
Beta Was this translation helpful? Give feedback.
-
Thanks @donmccurdy - That works for me, at least for now! Would be great to have an option to avoid the prune call in the normal draco extensions, so welding could still occur. I'm not sure how weld with a tolerance of 0 could ever remove a mesh, so in the case of draco(), it seems like this shouldn't prune at all. Am I missing something? |
Beta Was this translation helpful? Give feedback.
-
Thanks - Submitted a PR here - #1059 I think this is all that's required for this? (It's just a couple of lines of code wrapping that prune call). Let me know if you want any other tweaks to it, though. This would be better than the simplified draco option (which I'm using now), as that doesn't support all of the options the normal draco function supports. |
Beta Was this translation helpful? Give feedback.
-
Hello,
I am currently using Document.transform() to add draco compression to an existing GLB.
However, in the process, this strips out scene nodes from the GLB file which are empty (other than metadata). For our custom application, we rely on the existence of these for various features, as the metadata can provide instructions for things that happen post-load of the GLB.
Is there a way to run this through Document.transform to draco compress without stripping out empty nodes? Currently, we only call this with draco(), ie:
I've also tried explicitly adding prune() with options for keeping leaves or attributes, as they seemed potentially related, but that has no impact - the empty scene nodes are still removed.
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions