-
Notifications
You must be signed in to change notification settings - Fork 165
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
Does it support raytrace mouse clicks? #289
Comments
I'm not sure how you're currently doing raycasting, but it won't work with three.js' raycaster, because raycasting against a splat mesh works differently (it returns intersections with splats, not three.js meshes). Here is an example of how to use the raycaster that I made for this library specifically for raycasting against splats:
|
Many thanks. I will try your code. I was actually using raycasting against the XYZ points with world coordinates (like a point cloud). It was actually working, but it needed a bit of work to handle it. I just could not do it with the meshes themselves because three js saw the splats as invisible. Do you also know if it’s possible to add objects that would be able to blend with the splats? For example, if I add an object with 50% opacity, in front of the splat, then the splats are still not visible through the box. Tried it with depth tests but nothing seems to work. I hope you understand what I mean. Thanks for the code!! |
Do you also have a function where you can select a set of splats by dragging the mouse over a select splats and capture their data? Thanks! |
Ok, I managed to be able to do this. Just by dragging I am able to select the hits within the selected area, even if several rays hits a splat, its only counted once. If I want to change the color of the selected area, which function/data can I change to have them being rendered in another color? For example, I select an area and it becomes yellow to indicate selected gaussians. @mkkellogg Array(98) |
There is no direct way to change a splat's color, so you'll have to implement it yourself. You can take a look at the GaussianSplats3D/src/loaders/SplatBuffer.js Line 291 in ef524f4
Once you have changed the splat's color in the splat buffer, you'll need to update the GPU data textures with the appropriate values. That can be done using the SplatMesh.refreshDataTexturesFromSplatBuffers() function.There is probably more complexity to doing this (and edge cases that I haven't thought of) than I have addressed here, so you'll probably have to spend some time digging through and learning the code. Also, if you change a splat's color, you'll need to remember it so you can store it later :) |
Ok, thanks. Can I assume globalsplatindex is the index of the splat itself, which we store in the sectionindex inside the function? outColor[0-3] is RGBA, correct? And outcolor[] is the one that we actually use in the refresh function? So if I fetch the globalindex first, modify the colours, and then call splatbuffer and refreshtextures, it should be feasible? Does it refresh the whole Gaussian splats or just those we modify? I am still new to programming so please have patience with me. 😆 |
So my plan here is to use AABB bounding box to get a box from two views. By fetching a screenshot and a specific cropped view, I will send these to SAM segmentation model and get the binary masks back. I am wondering, I am trying to find the function to access the XYZ points within a set box, but cannot. What function can I call to get the splatsindex as well as XYZ coordinates within bounding box? I am having a little trouble finding those functions. Thank you. |
here is an example where I have managed to integrate SAM 2 with a backend with your interactive Gaussian Splatting Viewer GUI. Looks awesome. By selecting an area, I am able to segment certain areas. However, would be cool to highlight to splats via some kind of selection hue color. Could you please share how to access the points values XYZ, RGBA, opacity etc... for each splat in the Viewer pipeline? Thank you! |
All splat data is stored in one or more GaussianSplats3D/src/splatmesh/SplatMesh.js Line 886 in ef524f4
Currently when a scene is being loaded, the fillSplatDataArrays() function is used to pull the splat data (XYZ position, color, etc...) from the splat buffer and that data is pushed to a three.js texture, which is how it gets to the GPU. An example of that second step is here: GaussianSplats3D/src/splatmesh/SplatMesh.js Line 919 in ef524f4
|
Thank you! I will get back to you in case of more questions. 👍 |
@mkkellogg I have tried to expose SplatMesh but it seems that I cannot still access those functions via the npm package. Any suggestions for a sample code on how you do it with the viewer, please? When I try to read the contents, it say that they are undefined for some reason. |
Sorry for the late response, you will have to access the instance of
|
Hello,
I am wondering if this would support raytracing the splats themselves rather than the XYZ points? I am trying to create a mouse interactor but at the moment, it seems that mouse interaction with splats is not possible unless you click in the center of the splat (points).
Any suggestion? Or would this require further adjustments to the custom shaders?
The text was updated successfully, but these errors were encountered: