Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could SplatMesh be made compatible with Three.Box3.setFromObject / expandByObject ? #363

Open
turien-pix4d opened this issue Nov 7, 2024 · 0 comments

Comments

@turien-pix4d
Copy link

turien-pix4d commented Nov 7, 2024

Three.Box3.setFromObject and Three.Box3.setFromObject compute a bounding box of any 3D objects by searching for specific properties and recursively repeating the operation in the descendant of that object 1. For now, they produce incorrect results on SplatMesh or any objects with a SplatMesh in its descendant.

Those two method look for a property called boundingBox. When it's undefined, they assume the object have no bounding box, and try to use its geometry instead if it's null they suppose the object can compute its bounding box but does not have done it yet. As SplatMesh initializes its boundingBox to a new Box3(), those methods are unable to trigger the box computation and just use this empty box as if it was the correct value.

When they find a bounding box with a value "null", those methods call the computeBoudingBox method of the object with no parameter, then assume the boundingBox property of the object will be updated after this call. SplatMesh.computeBoudingBox do exist, but it does not update the boundingBox property of the mesh. That mean just setting the bounding box of a SplatMesh before using those methods won't make them work better.

Finally, when computing the bounding box of a composite object, those methods aggregate the bounding boxes of all its children together without applying any transform on them. They assume those box are all given in the global coordinate system. By default, the SplatMesh does not compute is bounding box in the global coordinate system.

Footnotes

  1. https://github.com/mrdoob/three.js/blob/dev/src/math/Box3.js#L155

@turien-pix4d turien-pix4d changed the title Make SplatMesh compatible with Three.Box3.setFromObject / expandByObject Could SplatMesh be made compatible with Three.Box3.setFromObject / expandByObject ? Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant