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

Support rectangle selection in viewer #3014

Merged
merged 9 commits into from
Mar 25, 2024
Merged

Support rectangle selection in viewer #3014

merged 9 commits into from
Mar 25, 2024

Conversation

chungmin99
Copy link
Contributor

Related to rect-select viser PR, linked here: nerfstudio-project/viser#157.

This adds ViewerRectSelect, a rectangular selection in 2D parameterized by its min/max bounds. This PR also adds screen_pos property to ViewerClick, the screen position associated with the click.

There's many exciting applications for this -- especially in splatfacto, where we can select groups of gaussians. One example is #3001, for floater removal (@anniezhang2288 :) )

The example video shows both interaction types, clicking and rectangular selection. More specifically, for the rectangular selection, the video shows:

  • how gaussians can be selected -- only keeping the gaussians that project inside the selection box.
  • ... and what happens if you continue training.
dragbox.mp4

@brentyi
Copy link
Collaborator

brentyi commented Mar 22, 2024

Question: does it make sense to move toward deprecating the ViewerElement API? Would it make sense to give models access to the ViserServer instance directly?

(I'm not super familiar with the viewer elements workflow)

CONSOLE.log("`register_click_cb` is deprecated, use `register_pointer_cb` instead.")
self.register_pointer_cb("click", cb)

def register_pointer_cb(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it might be good to throw an error if the user tries to register two click callbacks before unregistering one? just for transparency that only one at a time works

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Viser should raise warnings if a callback is unregistered, see commit here: nerfstudio-project/viser@2beac59

... do you think we should throw an error?

Example warning:
image

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it'd be a bit cleaner if there was a warning from ViewerControl too for traceability yea, if that's easy

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, addressed in ec21904 via catching warnings; now it prints like the img below:

image

So it should at least fwd you to the correct nerfstudio function.

@kerrj
Copy link
Collaborator

kerrj commented Mar 22, 2024

Question: does it make sense to move toward deprecating the ViewerElement API? Would it make sense to give models access to the ViserServer instance directly?

(I'm not super familiar with the viewer elements workflow)

Technically you can already access the viser API through ViewerControl.viser_server, although it's definitely messy since then theres a divide between the pre-defined buttons and the dynamically added buttons.

Making the viewer_elements abstraction thinner somehow would be nice, but we do need some sort of abstraction if we want the viewer to have the nice auto-populating behavior that it does right now (recursively scrape the pipeline for viewer elements).

The main annoyance with accessing the ViserServer is how to treat the "static" (predefined in model file) gui elements vs the "dynamic" (added during runtime) elements. Which panel do they go on, what order, etc. And how do we keep the same API for both?

Copy link
Collaborator

@kerrj kerrj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exciting stuff, lgtm :)

@kerrj kerrj enabled auto-merge (squash) March 25, 2024 19:37
@kerrj kerrj merged commit 71de071 into main Mar 25, 2024
2 checks passed
@kerrj kerrj deleted the cmk/add-rectselect branch March 25, 2024 19:48
Michael-Spleenlab pushed a commit to Michael-Spleenlab/nerfstudio that referenced this pull request Apr 26, 2024
* Support rectangle selection in viewer

* Update doc for click screen_pos

* Raise callback override warning from nerfstudio

* Bump viser version, rect-select only in >0.1.26
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

Successfully merging this pull request may close these issues.

3 participants