petrbroz / svf-utils

Utilities for working with the SVF file format used by Autodesk Platform Services.
https://petrbroz.github.io/svf-utils/
MIT License
123 stars 53 forks source link

better 'center' support #44

Closed wallabyway closed 1 year ago

wallabyway commented 2 years ago

The center : true option, adds a root node to the glTF with an offset calculated by the global bounds.

However, this can be a problem if the dbid filtered list is used. The offset value may be at origin, meanwhile the subset of dbids are far away from origin.

Is it possible to calculate the offset of the group of dbids (the filter function), and use that inside the root node offset ? Here's an example of a dbid filter: https://gist.github.com/wallabyway/4cd3112b3e86dc6d235bd3a0d86e87a5#file-convert-js-L25

Also, are the mesh vertices normalized with the gltf node xform (without dedup) ? ie. I'm trying to reduce jitter. (similar to this article https://stackoverflow.com/a/53858720/8093318)

petrbroz commented 2 years ago

I've implemented a fix and made it available in fix/center branch. Please try it out and let me know if it centers the model as you'd expect.

wallabyway commented 1 year ago

Resolved! Thank you