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

Incorrect bounding box using the threejs scene #351

Open
pesa2000 opened this issue Oct 15, 2024 · 4 comments
Open

Incorrect bounding box using the threejs scene #351

pesa2000 opened this issue Oct 15, 2024 · 4 comments

Comments

@pesa2000
Copy link

Hi Mark, im trying to setup a mesh to put under the bottom of a splat.

The best way to achieve that is to calculate the lower bottom using the bounding box, whatever method i try i cant retrieve the correct coordinates for the box.

Any suggestions?

Thank you in advance

@Patrick-van-Halm-360Fabriek

We have a solution for this, with the latest update 0.4.5 @mkkellogg introduced the SplatMesh.computeBoundingBox() method. To access this you need to access the viewer. Some psuedo code would be:

const viewer = new GaussianSplats3D.DropInViewer({
  ...
});

viewer.addSplatScene(...);

const bounds = viewer.splatMesh.computeBoundingBox();
const size = bounds.getSize(new THREE.Vector3()); // Y being the full height of the bounds
const center = bounds.getCenter(new THREE.Vector3());

const lowerBottom = new THREE.Vector3(center.x, center.y - (size.y / 2), center.z); // This is the lowest bounds in the center of the object

@pesa2000
Copy link
Author

Hi @Patrick-van-Halm-360Fabriek, thank you very much, im actually trying this right now.

const bounds = this.viewer.splatMesh.computeBoundingBox();
const boxHelper = new THREE.Box3Helper(bounds, 0xff0000);
this.scene.add(boxHelper);

Using the code below to render the bounds i get this as a result.

image

Maybe is it related to the scale of the splat?

@pesa2000
Copy link
Author

Update: passing true as the first param helps since is going to apply the same transformations applied to the scene.

The result is still a little bit off.

image

@Patrick-van-Halm-360Fabriek

I don't know if the Box3Helper does fully work with the splat Bounds. Maybe @mkkellogg could join in with the specific information about it.

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

2 participants