mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-18 22:04:02 +08:00
Migrate to viser viewer (#2515)
* fix jittering in markdown in viewer beta
* Revert "fix jittering in markdown in viewer beta"
This reverts commit 70ade42e46.
* Migrate to viser viewer
* Fix docs
* print correctly formatted url in banner for viewer beta
* add deprecation warnings to viewer_elements.py
* fix export string scientific notation bug, change .5 to 2.0 sec transition time
---------
Co-authored-by: Justin Kerr <justin.g.kerr@gmail.com>
This commit is contained in:
1 parent
ca9e6c1294
commit
451a70c1f3
92 files changed
+133
-124
No files matched your search
@@ -9,10 +9,10 @@ We provide support for custom viewer GUI elements that can be defined in any `nn
|
||||
|
||||
## Adding an Element
|
||||
|
||||
To define a custom element, create an instance of one of the provided classes in `nerfstudio.viewer.server.viewer_elements`, and assign it as a class variable in your `nn.Module`.
|
||||
To define a custom element, create an instance of one of the provided classes in `nerfstudio.viewer.viewer_elements`, and assign it as a class variable in your `nn.Module`.
|
||||
|
||||
```python
|
||||
from nerfstudio.viewer.server.viewer_elements import ViewerNumber
|
||||
from nerfstudio.viewer.viewer_elements import ViewerNumber
|
||||
|
||||
class MyClass(nn.Module):#must inherit from nn.Module
|
||||
def __init__(self):
|
||||
@@ -20,7 +20,7 @@ class MyClass(nn.Module):#must inherit from nn.Module
|
||||
self.custom_value = ViewerNumber(name="My Value", default_value=1.0)
|
||||
```
|
||||
**Element Hierarchy**
|
||||
The viewer recursively searches all `nn.Module` children of the base `Pipeline` object, and arranges parameters into folders based on their variable names.
|
||||
The viewer recursively searches all `nn.Module` children of the base `Pipeline` object, and arranges parameters into folders based on their variable names.
|
||||
For example, a `ViewerElement` defined in `pipeline.model.field` will be in the "Custom/model/field" folder in the GUI.
|
||||
|
||||
**Reading the value**
|
||||
@@ -81,7 +81,7 @@ Updating module state while training can have unexpected side effects. It is up
|
||||
This was created with the following elements:
|
||||
|
||||
```python
|
||||
from nerfstudio.viewer.server.viewer_elements import *
|
||||
from nerfstudio.viewer.viewer_elements import *
|
||||
|
||||
class MyModel(Model):
|
||||
def __init__(self):
|
||||
|
||||
@@ -14,7 +14,7 @@ Just like `ViewerElements`, you can create an instance inside any class which in
|
||||
and is contained within the `Pipeline` object (for example the `Model`)
|
||||
|
||||
```python
|
||||
from nerfstudio.viewer.server.viewer_elements import ViewerControl
|
||||
from nerfstudio.viewer.viewer_elements import ViewerControl
|
||||
|
||||
class MyModel(nn.Module): # Must inherit from nn.Module
|
||||
def __init__(self):
|
||||
@@ -25,7 +25,7 @@ class MyModel(nn.Module): # Must inherit from nn.Module
|
||||
To get the current camera intrinsics and extrinsics, use the `get_camera` function. This returns a `nerfstudio.cameras.cameras.Cameras` object. This object can be used to generate `RayBundles`, retrieve intrinsics and extrinsics, and more.
|
||||
|
||||
```python
|
||||
from nerfstudio.viewer.server.viewer_elements import ViewerControl, ViewerButton
|
||||
from nerfstudio.viewer.viewer_elements import ViewerControl, ViewerButton
|
||||
|
||||
class MyModel(nn.Module): # Must inherit from nn.Module
|
||||
def __init__(self):
|
||||
@@ -47,10 +47,10 @@ class MyModel(nn.Module): # Must inherit from nn.Module
|
||||
```
|
||||
|
||||
## Set Camera Properties
|
||||
You can set the viewer camera position and FOV from python.
|
||||
You can set the viewer camera position and FOV from python.
|
||||
To set position, you must define a new camera position as well as a 3D "look at" point which the camera aims towards.
|
||||
```python
|
||||
from nerfstudio.viewer.server.viewer_elements import ViewerControl,ViewerButton
|
||||
from nerfstudio.viewer.viewer_elements import ViewerControl,ViewerButton
|
||||
|
||||
class MyModel(nn.Module): # Must inherit from nn.Module
|
||||
def __init__(self):
|
||||
@@ -66,7 +66,7 @@ class MyModel(nn.Module): # Must inherit from nn.Module
|
||||
We forward *single* clicks inside the viewer to the ViewerControl object, which you can use to interact with the scene. To do this, register a callback using `register_click_cb()`. The click is defined to be a ray that starts at the camera origin and passes through the click point on the screen, in world coordinates.
|
||||
|
||||
```python
|
||||
from nerfstudio.viewer.server.viewer_elements import ViewerControl,ViewerClick
|
||||
from nerfstudio.viewer.viewer_elements import ViewerControl,ViewerClick
|
||||
|
||||
class MyModel(nn.Module): # must inherit from nn.Module
|
||||
def __init__(self):
|
||||
@@ -89,4 +89,3 @@ You can also use `unregister_click_cb()` to remove callbacks that are no longer
|
||||
|
||||
### Thread safety
|
||||
Just like `ViewerElement` callbacks, click callbacks are asynchronous to training and can potentially interrupt a call to `get_outputs()`.
|
||||
|
||||
Reference in new issue
Block a user