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

Regarding suggestions for the API interface #149

Open
gotoeasy opened this issue Mar 11, 2024 · 13 comments
Open

Regarding suggestions for the API interface #149

gotoeasy opened this issue Mar 11, 2024 · 13 comments

Comments

@gotoeasy
Copy link

Please consider incorporating additional methods into the interface to enable control over various rendering effects as needed through coding.

For example:

  • viewer.changeSplatAlphaRemovalThreshold(...)
  • viewer.changeRenderMode(...) - Normal mode/Point cloud mode
  • viewer.removeSplatScene(...)
  • ...
@gotoeasy
Copy link
Author

Is it possible to achieve some rendering effects similar to those in the image below by adjusting certain parameters or providing interface methods? For example, tweaking the model's perspective to generate an image resembling a sketch effect that I personally like—how cool would that be!

graphdeco-inria/gaussian-splatting#427
image

@mkkellogg
Copy link
Owner

Functions like viewer.changeSplatAlphaRemovalThreshold() and viewer.removeSplatScene() make sense, but I'm not sure what you mean by viewer.changeRenderMode(), specifically what do you mean by "normal mode" and "Point cloud mode" ?

As far as mimicking the effects in the above pictures, I imagine there are all kinds of cool effects I could enable if I spent some time experimenting, or looked into what others have done with GS renderers, it's really just a matter of having the time to do so :)

@gotoeasy
Copy link
Author

Functions like viewer.changeSplatAlphaRemovalThreshold() and viewer.removeSplatScene() make sense, but I'm not sure what you mean by viewer.changeRenderMode(), specifically what do you mean by "normal mode" and "Point cloud mode" ?

"normal mode" refers to the current completed effect, while "Point cloud mode" refers to a display in a point-like manner, similar to the top left image above, or the appearance of a point model as initially shown by Luma.

The reason for this request is mainly because in large scene displays, it can provide a focusing effect (rendering areas of non-focus in a point-like manner), reduce model file sizes, or significantly improve rendering performance.

@koktavy
Copy link

koktavy commented Mar 25, 2024

+1 for removeSplatScene, could you provide pseudo code for this? I'd give it a go.

I see dispose in SceneHelper but that looks more like a total cleanup.

@mkkellogg
Copy link
Owner

Yeah dispose() will release all resources held by the viewer. I plan on adding a removeSplatScene() function in the next release, so you won't have to wait too much longer :)

@gotoeasy
Copy link
Author

In the current version v0.3.8, pressing the 'P' key switches to PointCloudMode, but there is currently no transition effect during the switch, which can feel rather abrupt.
To achieve a transition effect similar to what Luma has, how should the code be modified? @mkkellogg

@mkkellogg
Copy link
Owner

You'd have to modify the shader for SplatMesh in this area:

eigenValue1 = eigenValue2 = 0.2;

Basically you'd want to interpolate between using eigen-values calculated from the covariances and the hard-coded eigen-values for point-cloud mode (0.2) over some time interval. BTW 0.2 was chosen arbitrarily, both eigen-values just needed to be equal to each for point-cloud mode.

@gotoeasy
Copy link
Author

gotoeasy commented May 7, 2024

Thanks for your response, after continuous experimentation I can finally see the result with splat. But it doesn't seem to work with ksplat, the values of both visibleRegionFadeStartRadius and visibleRegionRadius are always 0. Does ksplat not support the transition effect of the ever-expanding radius?

@gotoeasy
Copy link
Author

gotoeasy commented May 8, 2024

Thanks for your response, after continuous experimentation I can finally see the result with splat. But it doesn't seem to work with ksplat, the values of both visibleRegionFadeStartRadius and visibleRegionRadius are always 0. Does ksplat not support the transition effect of the ever-expanding radius?

the ksplat converted in version 0.4.0 is ok, please ignore this.

@gotoeasy
Copy link
Author

gotoeasy commented May 9, 2024

The current transition approach seems to prioritize the outward spread of a radius from a horizontal center point, without considering height. For example, a table would load from the base upwards, while the tabletop would load later, which can feel unnatural. Similarly, for a building, the rooftop would load later.

Would it be possible to incorporate height into the consideration, such that loading within the same radius prioritizes height?

image

image

@mkkellogg
Copy link
Owner

The reason I chose the approach to revealing the scene is that it matches the way splats are physically organized in .ksplat files, and the reason splats are organized in that manner is that it allows for better cache coherency for sorting and rendering at runtime. It would be possible to arrange the splats in a way that would make your approach to revealing the scene possible, but you'd have to implement a new way to do that as part of the export to .ksplat, and you'd need to include a flag in the file so that when it comes time to load the splats, the viewer knows how the splats are arranged and can choose the appropriate scene reveal function.

The code that performs the current splat arrangement is here:

const partitionGenerator = (splatArray) => {

You'd have to add a new function to achieve your own desired organization, and then update the relevant parts of the code to use it, as well as add the aforementioned flag specifiying organization method to the .ksplat format. Then you'd have to update SplatMesh to choose the approach reveal mode at load time, as well as implement the new reveal mode.

So it definitely wouldn't be a trivial amount of work, but it's certainly doable :)

@gotoeasy
Copy link
Author

Considering only one scene, how to get the maximum height and set it to sceneCenter? If set in this way, I think it may be possible to display it progressively from high to low, and the file structure of the model does not need to be changed.

@gotoeasy
Copy link
Author

Modifying sceneCenter doesn't seem to work, a compromise is to just compare the horizontal distance, the high point can be shown at the same time. Not sure if this is a good approach, so I'm not submitting a PR.

// SplatMesh.js
-        float centerDist = length(splatCenter - sceneCenter);
+        float centerDist = length(vec3(splatCenter.x, 0.0, splatCenter.z)- sceneCenter);

image

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

3 participants