GaussianSplats3D
GaussianSplats3D copied to clipboard
select and move splat scene
Thank you for your great work.
I'm trying to use the viewer to load multiple splat scenes and move them like normal three objects. It seems like we can't determine the scene index with your raycaster, and using normal threejs raycaster can only select a invisible mesh at very center of the splat scene and control whole viewer. Any hint on how can i achive use raycast select individual splat scenes? And after selection I think I will be able to attach the splat to Transform control and move it.
You should be able to to use the splat index to determine the scene index with something like:
viewer.raycaster.intersectSplatMesh(viewer.splatMesh, hits);
if (hits.length > 0) {
const closestHit = hit[0];
const sceneIndex = viewer.splatMesh.getSceneIndexForSplat(closestHit.splatIndex);
}
Thank you very much for your response. I am now able to set the visibility of the selected scene index. Could you please suggest a method to attach the Transform control from Three.js to the selected scene? In DropInViewer, I can attach the viewer to the Transform control, but I am unsure how to attach the splat scenes.
Sorry for the late response, there isn't really a way to attach Transform controls to an individual splat scene, it has to be attached to DropInViewer or Viewer.splatMesh.
I had (sort of) the same issue and solved it by using an invisible three.js cube to attach to the transformcontrol and then syncing the splatMesh using:
transformControl.addEventListener('objectChange', () = > { /* update active splatMesh here */ } )
Maybe something like that could work for you as well @TianyuHuang-000
I know this is a bit late, but the most recent release contains an updated way to modify a scene's position, orientation, and scale much in the same way you would modify those attributes for a standard three.js object. I added a demo page that demonstrates the new functionality (demo/dynamic_dropin.html). The most relevant portion begins at this line:
https://github.com/mkkellogg/GaussianSplats3D/blob/2d80511077fcb83ec5cb6da7336dc38e55d4a14b/demo/dynamic_dropin.html#L140
Thanks Mark, adding it to a mesh and then transforming it works great! In my case, I don't wan't to show a mesh, so I created a new Object3D instead and added the splat, which works too.
Great, glad that worked for you!
Thank you both so much for your help! By the way, is there a straightforward way to obtain the splat center for each splat scene? Currently, the center appears to be set to (0, 0, 0), and all rotations and translations seem to be relative to the origin point.
Yeah the origin of the scene, at least for all transformations will be always be at <0, 0, 0>