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

Clipping Planes with Gaussian Splats #238

Open
aayork opened this issue May 22, 2024 · 4 comments
Open

Clipping Planes with Gaussian Splats #238

aayork opened this issue May 22, 2024 · 4 comments

Comments

@aayork
Copy link

aayork commented May 22, 2024

I'm trying to find a way to clip a part of my splat, but I haven't really seen anything about this online. Has anyone had any luck with clipping? Is it possible with this library?

@TheExDeus
Copy link

Easiest option is to do this in vertex shader, but if you don't need to change it in real-time and only do it once, then it can be done via pre-processing step where you remove splats manually. It would required regeneration of the octree in this viewer though, AFAIK.
In vertex shader the gaussian splat position is define here:
https://github.com/mkkellogg/GaussianSplats3D/blob/main/src/SplatMesh.js#L219
So if you pass, for example, a uniform zoffset to throw away any gaussian above a specific Z value (which means it's just a 3D plane moving upwards), then you can do:

if (splatCenter.z > zcutoff) {
  gl_Position = vec4(0.0, 0.0, 2.0, 1.0);
  return;
}

@mkkellogg
Copy link
Owner

I've been thinking about the best way to accomplish something like this and I think I'm going to add a feature where you can specify an arbitrary number of clipping shapes (plane, cube, sphere, etc.). I'm simultaneously developing a feature to toggle the visibility of individual splat scenes, so the same code in the shader could be used to hide/show splats for both.

@Wyundi
Copy link

Wyundi commented Jun 15, 2024

I add a filter in SplatLoader to skip the point I don't want. For clip, I set a range for position of each point. And it can avoid modifying the shader.

@xiasun
Copy link

xiasun commented Jun 18, 2024

Is there a way to do plane clipping based on exact positions instead of centers? Just like clipping a normal mesh?Clipping of centers will only decide whether a splat is shown or not, and the rendering results of the boundary tend to be rough.

I was wondering if there's a way to achieve real clipping, to make part of a splat point visible while part of it invisible?

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

5 participants