Visualization
- class fvdb.viz.CamerasView(scene_name: str, name: str, camera_to_world_matrices: Tensor, projection_matrices: Tensor, image_sizes: Tensor, axis_length: float, axis_thickness: float, frustum_line_width: float, frustum_scale: float, frustum_color: tuple[float, float, float], frustum_near_plane: float, frustum_far_plane: float, enabled: bool, _private: Any = None)[source]
A view for a set of camera frusta and axes in a
fvdb.viz.Scenewith parameters to adjust how the cameras are rendered.Each camera is represented by its camera-to-world and projection matrices, and drawn as a wireframe frustum with orthogonal axes at the camera’s origin.
- property axis_length: float
Get the length of the axes drawn at each camera origin in world units.
- Returns:
length (float) – The length of the axes.
- property axis_thickness: float
Get the thickness of the axes drawn at each camera origin in pixel units.
- Returns:
thickness (float) – The thickness of the axes.
- property enabled: bool
Return whether the camera frusta and axes are shown in the scene.
- Returns:
enabled (bool) –
Trueif the camera frusta and axes are shown in the scene,Falseotherwise.
- property frustum_color: Tensor
Get the RGB color of the frustum lines as a tensor of shape
(3,)with values in[0, 1].- Returns:
torch.Tensor – The RGB color of the frustum lines.
- property frustum_line_width: float
Get the line width of the frustum in the camera frustum view.
- property frustum_scale: float
Get the scale factor applied to the frustum visualization. Each frustum will have its size multiplied by this scale factor when rendered.
E.g. if the frustum has
near = 0.1, andfar = 1.0, then setting the frustum scale to2.0will render the frustum as ifnear = 0.2andfar = 2.0.- Returns:
scale (float) – The scale factor applied to the frustum visualization.
- class fvdb.viz.CheckboxView(scene_name: str, name: str, initial: bool = False, _private: Any = None)[source]
Handle to a checkbox widget in the editor’s Scene Params window.
- property value: bool
- class fvdb.viz.FogVolumeView(scene_name: str, name: str, view_names: list[str], _private: Any = None)[source]
A view for rendering an fvdb
Grid(orGridBatch) as a volumetric fog in the viewer.The grid is rendered via ray-marching using the
nanovdb_renderpipeline. Per-voxel density values are stored as float32 blind metadata on the ONINDEX NanoVDB grid.The nanovdb-editor renders one grid per view. A
GridBatchwith more than one grid is therefore expanded into one view per grid, namedname[i].- property name: str
- property scene_name: str
- update(grid: Grid | GridBatch, density: JaggedTensor) None[source]
Replace the fog-volume data in the viewer.
- Parameters:
grid – The sparse grid (or batch of grids) the density field lives on.
density – Per-voxel float32 density values (one per active voxel, non-negative).
- class fvdb.viz.GaussianSplat3dView(scene_name: str, name: str, means: Tensor, quats: Tensor, log_scales: Tensor, logit_opacities: Tensor, sh0: Tensor, shN: Tensor, tile_size: int = 16, min_radius_2d: float = 0.0, eps_2d: float = 0.3, antialias: bool = False, sh_degree_to_use: int = -1, sh_ordering_mode: ShOrderingMode = ShOrderingMode.RGB_RGB_RGB, _private: Any = None)[source]
- property eps_2d: float
Get the 2D epsilon value used for rendering splats.
- Returns:
float – The 2D epsilon value.
- property min_radius_2d: float
Get the minimum radius in pixels below which splats will not be rendered.
- Returns:
float – The minimum radius in pixels.
- property sh_degree_to_use: int
Get the degree of spherical harmonics to use when rendering colors.
- Returns:
int – The degree of spherical harmonics to use.
- property sh_ordering_mode: ShOrderingMode
Get the spherical harmonics ordering mode used for rendering colors.
- Returns:
ShOrderingMode – The spherical harmonics tensor layout.
- property tile_size: int
Set the 2D tile size to use when rendering splats. Larger tiles can improve performance, but may exhaust shared memory usage on the GPU. In general, tile sizes of 8, 16, or 32 are recommended.
- Returns:
int – The current tile size.
- class fvdb.viz.GaussianSplatViewData(means: Tensor, quats: Tensor, log_scales: Tensor, logit_opacities: Tensor, sh0: Tensor, shN: Tensor, sh_ordering: ShOrderingMode = ShOrderingMode.RGB_RGB_RGB)[source]
Renderer-ready tensor data for a 3D Gaussian splat view.
This is an immutable container, but it does not clone or make its tensors immutable. All tensors must be floating-point tensors on the same device with the same dtype and the same leading Gaussian dimension
N.sh_orderingdescribes the layout of the last two dimensions ofsh0andshN:"rgb_rgb_rgb"uses shapes(N, 1, C)and(N, K - 1, C)."rrr_ggg_bbb"uses shapes(N, C, 1)and(N, C, K - 1).
- Parameters:
means – Gaussian means with shape
(N, 3).quats – Gaussian quaternions with shape
(N, 4)and component order(w, x, y, z).log_scales – Gaussian logarithmic scales with shape
(N, 3).logit_opacities – Gaussian opacity logits with shape
(N,).sh0 – Zeroth-order spherical harmonics coefficients.
shN – Higher-order spherical harmonics coefficients.
sh_ordering – Spherical harmonics tensor layout.
- log_scales: Tensor
- logit_opacities: Tensor
- means: Tensor
- quats: Tensor
- sh0: Tensor
- shN: Tensor
- sh_ordering: ShOrderingMode
- class fvdb.viz.ImageView(scene_name: str, name: str, width: int, height: int, _private: Any = None)[source]
A view for an RGBA8 image in a
fvdb.viz.Scene.Note
Images are stored as NanoVDB grids on the C++ side. The ImageView provides a Python interface for managing the image and updating its contents.
- property height: int
Get the height of the image in pixels.
- Returns:
height (int) – The image height.
- property name: str
Get the name of the image view.
- Returns:
name (str) – The name of this image view.
- property scene_name: str
Get the name of the scene this image view belongs to.
- Returns:
scene_name (str) – The name of the scene.
- update(rgba_image: Tensor | ndarray | int | float | integer | floating | Sequence[int | float | integer | floating] | Size)[source]
Update the image data displayed in the viewer.
- Parameters:
rgba_image (NumericMaxRank1) – A 1D uint8 tensor-like object of size
width * height * 4containing packed RGBA values. Each pixel is represented by 4 consecutive bytes (R, G, B, A) with values in [0, 255].
- property width: int
Get the width of the image in pixels.
- Returns:
width (int) – The image width.
- class fvdb.viz.LevelSetView(scene_name: str, name: str, view_names: list[str], _private: Any = None)[source]
A view for rendering an fvdb
Grid(orGridBatch) as an isosurface in the viewer.The grid is rendered via HDDA zero-crossing of the signed distance field using the
nanovdb_surfacepipeline. The SDF values are stored as float32 blind metadata on the ONINDEX NanoVDB grid so no tree reconstruction is required.The nanovdb-editor renders one grid per view. A
GridBatchwith more than one grid is therefore expanded into one view per grid, namedname[i].- property name: str
- property scene_name: str
- update(grid: Grid | GridBatch, sdf: JaggedTensor) None[source]
Replace the level-set data in the viewer.
- Parameters:
grid – The sparse grid (or batch of grids) the SDF lives on.
sdf – Per-voxel float32 SDF values (one per active voxel, world-space units).
- class fvdb.viz.NumberView(scene_name: str, name: str, initial: float = 0.0, min: float | None = None, max: float | None = None, step: float = 0.01, _private: Any = None)[source]
Handle to a float numeric drag widget in the editor’s Scene Params window.
- property max: float | None
Maximum value (or None when unbounded).
- property min: float | None
Minimum value (or None when unbounded).
- property step: float
Drag widget step size.
- property value: float
- class fvdb.viz.PointCloudView(scene_name: str, name: str, positions: Tensor, colors: Tensor, point_size: float, _private: Any = None)[source]
- property point_size: float
Get the size (in pixels) of points when rendering.
- Returns:
size (float) – The current point size.
- class fvdb.viz.Scene(name: str)[source]
- add_cameras(name: str, camera_to_world_matrices: Tensor | ndarray | int | float | integer | floating | Sequence[int | float | integer | floating] | Size | Sequence[Sequence[int | float | integer | floating]] | Sequence[Sequence[Sequence[int | float | integer | floating]]], projection_matrices: Tensor | ndarray | int | float | integer | floating | Sequence[int | float | integer | floating] | Size | Sequence[Sequence[int | float | integer | floating]] | Sequence[Sequence[Sequence[int | float | integer | floating]]], image_sizes: Tensor | ndarray | int | float | integer | floating | Sequence[int | float | integer | floating] | Size | Sequence[Sequence[int | float | integer | floating]] | None = None, axis_length: float = 0.3, axis_thickness: float = 2.0, frustum_line_width: float = 2.0, frustum_scale: float = 1.0, frustum_color: Tensor | ndarray | int | float | integer | floating | Sequence[int | float | integer | floating] | Size = (0.5, 0.8, 0.3), frustum_near_plane: float = 0, frustum_far_plane: float = 0.5, enabled: bool = True) CamerasView[source]
Add
CamerasViewto thisSceneand return the added camera view.- Parameters:
name (str) – The name of the camera view.
camera_to_world_matrices (NumericMaxRank3) – The 4x4 camera to world transformation matrices (one per camera) encoded as a tensor-like object of shape
(N, 4, 4)whereNis the number of cameras.projection_matrices (NumericMaxRank3 | None) – The 3x3 projection matrices (one per camera) encoded as a tensor-like object of shape
(N, 3, 3)whereNis the number of cameras. IfNone, it will use the projection matrix of the scene’s main camera.image_sizes (NumericMaxRank2 | None) – The image sizes as a tensor of shape
(N, 2)whereNis the number of cameras. such thatheight_i, width_i = image_sizes[i]is the resolution of thei-th camera. IfNone, the image sizes will be inferred from the projection matrices assuming square pixels and that the principal point is at the center of the image.axis_length (float) – The length of the axis lines in the camera frustum view.
axis_thickness (float) – The thickness (in world coordinates) of the axis lines in the camera frustum view.
frustum_line_width (float) – The width (in pixels) of the frustum lines in the camera frustum view.
frustum_scale (float) – The scale factor for the frustum size in the camera frustum view.
frustum_color (NumericMaxRank1) – The color of the frustum lines as a sequence of three floats (R, G, B) in the range [0, 1].
frustum_near_plane (float) – The near clipping plane distance for the frustum in the camera frustum view.
frustum_far_plane (float) – The far clipping plane distance for the frustum in the camera frustum view.
enabled (bool) – If True, the camera view UI is enabled and the cameras will be rendered. If False, the camera view UI is disabled and the cameras will not be rendered.
- add_checkbox(name: str, initial: bool = False) CheckboxView[source]
Add a checkbox widget to this scene’s Scene Params window.
- Parameters:
name (str) – Unique field name.
initial (bool) – Initial checkbox state.
- Returns:
CheckboxView – A handle whose
valueproperty reads or writesthe live bool value.
- add_fog_volume(name: str, grid: Grid | GridBatch, density: JaggedTensor) FogVolumeView[source]
Add an fvdb sparse grid with per-voxel density values to the viewer as a fog volume.
The volume is rendered by the
nanovdb_renderpipeline (ray-marcher). If a view withnamealready exists it is replaced.Note
The nanovdb-editor renders one grid per view. If
gridis aGridBatchwith more than one grid, one view is created per grid, namedname[i]for gridi.- Parameters:
name (str) – Unique name for this view within the scene.
grid – A
GridorGridBatchwhose active voxels define the domain.density – A
JaggedTensorof shape(N,)and dtypefloat32containing one non-negative density value per active voxel (summed over the batch).
- Returns:
fog_volume_view (FogVolumeView) – The newly created view.
- add_gaussian_splat_3d(name: str, gaussian_splat_3d: GaussianSplatViewData, tile_size: int = 16, min_radius_2d: float = 0.0, eps_2d: float = 0.3, antialias: bool = False, sh_degree_to_use: int = -1) GaussianSplat3dView[source]
Add Gaussian splat view data to the viewer and return a view for it.
- Parameters:
name (str) – The unique name of the Gaussian splat view within this scene.
gaussian_splat_3d (GaussianSplatViewData) – Renderer-ready Gaussian splat tensors and their spherical harmonics layout. Passing an object that only exposes the six legacy tensor properties remains supported temporarily, but is deprecated.
tile_size (int) – The tile size to use for rendering. Default is 16.
min_radius_2d (float) – The minimum radius in pixels to render. Default is 0.0.
eps_2d (float) – The 2D epsilon used when rendering. Default is 0.3.
antialias (bool) – Whether to use antialiasing. Default is False.
sh_degree_to_use (int) – The spherical harmonics degree to render.
-1selects the maximum degree available in the data. Default is -1.
- Returns:
GaussianSplat3dView – A view for the Gaussian splats added to the scene.
- add_gaussian_splat_tensors(name: str, *, means: Tensor, quats: Tensor, log_scales: Tensor, logit_opacities: Tensor, sh0: Tensor, shN: Tensor, sh_ordering: ShOrderingMode = ShOrderingMode.RGB_RGB_RGB, tile_size: int = 16, min_radius_2d: float = 0.0, eps_2d: float = 0.3, antialias: bool = False, sh_degree_to_use: int = -1) GaussianSplat3dView[source]
Add renderer-ready Gaussian splat tensors to the viewer and return a view for them.
All tensor parameters are keyword-only. They use the same shape and type contract as
GaussianSplatViewData.- Parameters:
name (str) – The name of the Gaussian splat 3D scene. This must be unique among all views added to the scene.
means (torch.Tensor) – Gaussian means with shape
(N, 3).quats (torch.Tensor) – Gaussian quaternions with shape
(N, 4)in(w, x, y, z)component order.log_scales (torch.Tensor) – Gaussian logarithmic scales with shape
(N, 3).logit_opacities (torch.Tensor) – Gaussian opacity logits with shape
(N,).sh0 (torch.Tensor) – Zeroth-order spherical harmonics coefficients.
shN (torch.Tensor) – Higher-order spherical harmonics coefficients.
sh_ordering (str) – Spherical harmonics tensor layout. Must be
"rgb_rgb_rgb"or"rrr_ggg_bbb". Default is"rgb_rgb_rgb".tile_size (int) – The tile size to use for rendering. Default is 16.
min_radius_2d (float) – The minimum radius in pixels to use when rendering splats. Default is 0.0.
eps_2d (float) – The epsilon value to use when rendering splats. Default is 0.3.
antialias (bool) – Whether to use antialiasing when rendering splats. Default is False.
sh_degree_to_use (int) – The degree of spherical harmonics to use when rendering colors. If -1, the maximum degree supported by the Gaussian splat 3D scene is used. Default is -1.
- Returns:
gaussian_splat_3d_view (GaussianSplat3dView) – A view for the Gaussian splats added to the scene.
- add_image(name: str, rgba_image: Tensor | ndarray | int | float | integer | floating | Sequence[int | float | integer | floating] | Size, width: int, height: int) ImageView[source]
Add an RGBA8 image to the viewer and return a view for it.
- Parameters:
name (str) – The name of the image view. This must be unique among all views added to the scene.
rgba_image (NumericMaxRank1) – A 1D uint8 tensor-like object of size
width * height * 4containing packed RGBA values. Each pixel is represented by 4 consecutive bytes (R, G, B, A) with values in [0, 255].width (int) – The width of the image in pixels.
height (int) – The height of the image in pixels.
- Returns:
image_view (ImageView) – A view for the image added to the scene.
- add_level_set(name: str, grid: Grid | GridBatch, sdf: JaggedTensor) LevelSetView[source]
Add an fvdb sparse grid with per-voxel SDF values to the viewer as an isosurface.
The surface is rendered by the
nanovdb_surfacepipeline (HDDA zero-crossing). If a view withnamealready exists it is replaced.Note
The nanovdb-editor renders one grid per view. If
gridis aGridBatchwith more than one grid, one view is created per grid, namedname[i]for gridi.- Parameters:
name (str) – Unique name for this view within the scene.
grid – A
GridorGridBatchwhose active voxels define the domain.sdf – A
JaggedTensorof shape(N,)and dtypefloat32containing one signed-distance value per active voxel (summed over the batch), in world-space units. Negative values are inside the surface, positive values are outside.
- Returns:
level_set_view (LevelSetView) – The newly created view.
- add_number(name: str, initial: float = 0.0, min: float | None = None, max: float | None = None, step: float = 0.01) NumberView[source]
Add a numeric drag widget (no slider) to this scene’s Params window.
- Parameters:
name (str) – Unique field name.
initial (float) – Initial value.
min (float | None) – Optional lower bound for clamping.
max (float | None) – Optional upper bound for clamping.
step (float) – Drag step size. Must be positive.
- Returns:
NumberView – A handle whose
valueproperty reads or writes thelive numeric value.
- add_point_cloud(name: str, points: Tensor | ndarray | int | float | integer | floating | Sequence[int | float | integer | floating] | Size | Sequence[Sequence[int | float | integer | floating]], colors: Tensor | ndarray | int | float | integer | floating | Sequence[int | float | integer | floating] | Size | Sequence[Sequence[int | float | integer | floating]], point_size: float)[source]
Add a point cloud with colors and world-space radii to the viewer and return a view for it.
Note
Colors must be in the range
[0, 1]. You can pass in a single color as a tuple of 3 floats to color all points the same.Note
You can pass in a single radius as a float to use the same radius for all points.
- Parameters:
name (str) – The name of the point cloud added to the viewer. This must be unique among all views added to the scene. If a point cloud with the same name already exists in the viewer, it will be replaced.
points (NumericMaxRank2) – The 3D points of the point cloud as a tensor-like object of shape
(N, 3)whereNis the number of points.colors (NumericMaxRank2) – The colors of the points as a tensor-like object of shape
(N, 3)whereNis the number of points. Alternatively, you can pass in a single color as a tensor-like object of shape(3,)to color all points the same.point_size (float) – The screen-space size (in pixels) of the points when rendering.
- Returns:
point_cloud_view (GaussianSplat3dView) – A view for the point cloud added to the scene.
- add_slider(name: str, min: float, max: float, initial: float | None = None, step: float = 0.01) SliderView[source]
Add a float slider widget to this scene’s Params window.
- Parameters:
name (str) – Unique field name. Used both as the widget label and as the lookup key on the scene; if a widget with this name already exists it is replaced.
min (float) – Minimum slider value.
max (float) – Maximum slider value (must be greater than
min).initial (float | None) – Initial slider value. Defaults to
minwhen not provided. Clamped to[min, max].step (float) – Slider step size. Must be positive.
- Returns:
SliderView – A handle whose
valueproperty reads or writes thelive slider value.
- add_text(name: str, initial: str = '', max_length: int = 256, commit_on_enter: bool = False) TextView[source]
Add a text input field to this scene’s Scene Params window.
The buffer commits per keystroke;
on_updatecallbacks fire on every change. Passcommit_on_enter=Trueto additionally enableTextView.on_submit(), which fires only when the user presses Enter.- Parameters:
name – Unique field name.
initial – Initial string value (must fit in
max_length - 1bytes when UTF-8 encoded; the last byte is the NUL terminator).max_length – Capacity of the underlying
char[N]buffer including the NUL terminator. Must be at least2.commit_on_enter – Enable Enter-driven
on_submitcallbacks.
- Returns:
TextView – A handle whose
valuereads or writes the live string.
- property camera_far: float
Get the far clipping plane distance for rendering. Objects farther from the camera than this distance will not be rendered.
- Returns:
far (float) – The far clipping plane distance.
- property camera_fov: float
Return the camera’s vertical field of view in radians.
This is the full angle from the top of the frame to the bottom of the frame.
- Returns:
fov (float) – Vertical field of view in radians.
- property camera_near: float
Get the near clipping plane distance for rendering. Objects closer to the camera than this distance will not be rendered.
- Returns:
near (float) – The near clipping plane distance.
- property camera_orbit_center: Tensor
Return center of the camera orbit in world coordinates.
See also
See also
Note
The camera itself is positioned at:
camera_position = orbit_center + orbit_radius * orbit_direction- Returns:
center (torch.Tensor) – A tensor of shape
(3,)representing the camera orbit center in world coordinates.
- property camera_orbit_direction: Tensor
Return the direction pointing from the camera position toward the orbit center.
See also
See also
Note
The camera itself is positioned at:
camera_position = orbit_center - orbit_radius * orbit_direction- Returns:
direction (torch.Tensor) – A tensor of shape
(3,)representing the direction pointing from the camera position toward the orbit center.
- property camera_orbit_radius: float
Return the radius of the camera orbit.
See also
See also
Note
The camera itself is positioned at:
camera_position = orbit_center + orbit_radius * orbit_direction- Returns:
radius (float) – The radius of the camera orbit.
- property camera_up_direction: Tensor
Return the up vector of the camera. i.e. the direction that is considered ‘up’ in the camera’s view.
- Returns:
up (torch.Tensor) – A tensor of shape
(3,)representing the up vector of the camera.
- get_widget(name: str) SliderView | NumberView | TextView | CheckboxView | None[source]
Look up a previously-added widget on this scene by name.
- poll_widgets() list[str][source]
Fire any pending
on_updateandon_submitcallbacks.on_updatefires when the widget value changed since the last poll.on_submitfires when aTextViewcreated withcommit_on_enter=Trueobserved a fresh Enter press. Returns the names of the widgets that fired any callback (each name at most once per call).
- reset()[source]
Reset the scene. This will reset viewer server state and clear all views in the scene.
- set_camera_lookat(eye: Tensor | ndarray | int | float | integer | floating | Sequence[int | float | integer | floating] | Size, center: Tensor | ndarray | int | float | integer | floating | Sequence[int | float | integer | floating] | Size, up: Tensor | ndarray | int | float | integer | floating | Sequence[int | float | integer | floating] | Size = [0.0, 1.0, 0.0])[source]
Set the camera pose from a camera origin, a lookat point, and an up direction of this scene’s camera.
- Parameters:
eye (NumericMaxRank1) – A tensor-like object of shape (3,) representing the camera position in world coordinates.
center (NumericMaxRank1) – A tensor-like object of shape (3,) representing the point the camera is looking at.
up (NumericMaxRank1) – A tensor-like object of shape (3,) representing the up direction of the camera.
- class fvdb.viz.ShOrderingMode(*values)[source]
Enum representing spherical harmonics ordering modes used by Gaussian splats. Spherical harmonics for Gaussian splatting can be stored differently in memory depending on the application. For example, PLY files store spherical harmonics in
RRR_GGG_BBBorder, while some rendering codes (includingfvdb_reality_capture.GaussianSplat3d) useRGB_RGB_RGBorder.This enum defines two common ordering modes:
RGB_RGB_RGB: The feature channels are interleaved for each coefficient. i.e. The spherical harmonics tensor corresponds to a (row-major) contiguous tensor of shape[num_coefficients, num_sh_bases, channels], where channels=3 for RGB.RRR_GGG_BBB: The feature channels are stored in separate blocks for each coefficient. i.e. The spherical harmonics tensor corresponds to a (row-major) contiguous tensor of shape[num_coefficients, channels, num_sh_bases], where channels=3 for RGB.
- RGB_RGB_RGB = 'rgb_rgb_rgb'
The feature channels of spherical harmonics are interleaved for each coefficient. i.e. The spherical harmonics tensor corresponds to a (row-major) contiguous tensor of shape
[num_coefficients, num_sh_bases, channels], where channels=3 for RGB.
- RRR_GGG_BBB = 'rrr_ggg_bbb'
The feature channels of spherical harmonics are stored in separate blocks for each coefficient. i.e. The spherical harmonics tensor corresponds to a (row-major) contiguous tensor of shape
[num_coefficients, channels, num_sh_bases], where channels=3 for RGB.
- class fvdb.viz.SliderView(scene_name: str, name: str, min: float = 0.0, max: float = 1.0, initial: float = 0.0, step: float = 0.01, _private: Any = None)[source]
Handle to a float slider widget in the editor’s Scene Params window.
- property max: float
Maximum slider value.
- property min: float
Minimum slider value.
- property step: float
Slider step size.
- property value: float
- class fvdb.viz.TextView(scene_name: str, name: str, initial: str = '', max_length: int = 256, commit_on_enter: bool = False, _private: Any = None)[source]
Handle to a text input widget in the editor’s Scene Params window.
With
commit_on_enter=True(viaScene.add_text()), an Enter-drivenon_submit()callback becomes available alongside the per-keystrokeon_update().- property commit_on_enter: bool
True iff this widget was created with
commit_on_enter=True.
- property max_length: int
Capacity of the underlying
char[N]buffer in bytes.
- on_submit(callback: Callable[[str], None]) Callable[[str], None][source]
Register a callback that fires when the user presses Enter on this text input. Requires
commit_on_enter=True; otherwise raisesRuntimeError. Usable as a decorator:@query.on_submit def _(value: str) -> None: print("submitted:", value)
- remove_on_submit(callback: Callable[[str], None]) None[source]
Remove a previously-registered
on_submitcallback.
- property value: str
- fvdb.viz.get_scene(name: str = 'fVDB Scene') Scene[source]
Get a
fvdb.viz.Sceneby name from the viewer server. If the scene does not exist, this function creates a new scene with the given name.- Parameters:
name (str) – The name of the scene to get.
- Returns:
scene (fvdb.viz.Scene) – The scene with the given name.
- fvdb.viz.grid_edge_network(grid: Grid) tuple[Tensor, Tensor][source]
Return a set of line segments representing the edges of the active voxels in the grid. This can be useful for visualizing a
Gridas a wireframe.The line segments are represented by an
(N, 3)tensor of vertices and an(M, 2)tensor of indices into the vertex tensor. such that each edge is defined by a pair of vertex indices, whereedge_indices[j] = [v0, v1]means that the j-th edge connects vertices at positionsedge_vertices[v0]andedge_vertices[v1].Example usage:
import fvdb grid = fvdb.Grid.from_points(...) edge_vertices, edge_indices = fvdb.viz.grid_edge_network(grid) # Get the start and end position of each edge v0 = edge_vertices[edge_indices[:, 0]] # Start position v1 = edge_vertices[edge_indices[:, 1]] # End position
- Parameters:
- Returns:
edge_vertices (torch.Tensor) – A tensor of shape
(N, 3)representing the vertices of the edges.edge_indices (torch.Tensor) – A tensor of shape
(M, 2)representing the indices of the vertices that form each edge. i.e.edge_indices[j] = [v0, v1]means that the j-th edge connects vertices at positionsedge_vertices[v0]andedge_vertices[v1].
- fvdb.viz.gridbatch_edge_network(grid: GridBatch) tuple[fvdb._fvdb_cpp.JaggedTensor, fvdb._fvdb_cpp.JaggedTensor][source]
Return a set of line segments representing the edges of the active voxels in the grid batch. This can be useful for visualizing a
GridBatchas a wireframe.The line segments are represented by a jagged tensor of vertices and a jagged tensor of indices into the vertex tensor. such that each edge is defined by a pair of vertex indices, where
edge_indices[b][j] = [v0, v1]means that the j-th edge in the b-th grid connects vertices at positionsedge_vertices[b][v0]andedge_vertices[b][v1].Example usage:
import fvdb # Create a grid batch from multiple grids grid_batch = fvdb.GridBatch.from_grids([...]) # Get the edge network of the grid batch, defining line segments for each edge of the active voxels edge_vertices, edge_indices = fvdb.viz.gridbatch_edge_network(grid_batch) # Iterate over each grid in the batch, and get the start and end position of each edge for b in range(len(grid_batch)): # Get the start and end position of each edge in the b-th grid v0 = edge_vertices[b][edge_indices[b][:, 0]] # Start position v1 = edge_vertices[b][edge_indices[b][:, 1]] # End position # ... do something with v0 and v1 ...
- Parameters:
grid (GridBatch) – The
GridBatchto extract edges from with B grids.- Returns:
edge_vertices (JaggedTensor) – A jagged tensor of shape
(B, N_b, 3)representing the vertices of the edges.edge_indices (JaggedTensor) – A jagged tensor of shape
(B, M_b, 2)representing the indices of the vertices that form each edge. i.e.edge_indices[b][j] = [v0, v1]means that the j-th edge in the b-th grid connects vertices at positionsedge_vertices[b][v0]andedge_vertices[b][v1].
- fvdb.viz.init(ip_address: str = '127.0.0.1', port: int = 8080, vk_device_id: int = 0, verbose: bool = False)[source]
Initialize the viewer web-server on the given IP address and port. You must call this function first before visualizing any scenes.
Example usage:
import fvdb # Initialize the viewer server on localhost:8080 fvdb.viz.init(ip_address="127.0.0.1", port=8080) # Add a scene to the viewer with a point cloud in the scene scene = fvdb.viz.Scene("My Scene") scene.add_point_cloud(...) # Show the viewer in the browser or inline in a Jupyter notebook fvdb.viz.show() # Keep the script running until the user interrupts fvdb.viz.wait_for_interrupt()
Note
If the viewer server is already initialized, this function will do nothing and will print a warning message.
- Parameters:
ip_address (str) – The IP address to bind the viewer server to. Default is
"127.0.0.1".port (int) – The port to bind the viewer server to. Default is
8080.vk_device_id (int) – The Vulkan device ID to use for rendering. Default is
0.verbose (bool) – If True, the viewer server will print verbose output to the console. Default is
False.
- fvdb.viz.show()[source]
Show an interactive viewer in the browser or inline in a Jupyter notebook.
Example usage:
import fvdb # Initialize the viewer server on localhost:8080 fvdb.viz.init(ip_address="127.0.0.1", port=8080) # Add a scene to the viewer with a point cloud in the scene scene = fvdb.viz.Scene("My Scene") scene.add_point_cloud(...) # Show the viewer in the browser or inline in a Jupyter notebook fvdb.viz.show() # Keep the script running until the user interrupts fvdb.viz.wait_for_interrupt()
Note
You must call
fvdb.viz.init()before calling this function. If the viewer server is not initialized, this function will raise a RuntimeError.
- fvdb.viz.wait_for_interrupt()[source]
Block execution until the viewer is interrupted by the user.
This function blocks the current thread until the viewer receives an interrupt signal (via Ctrl-C). Use this to keep a script running while interacting with the viewer.
Gaussian splats
- class fvdb.viz.ShOrderingMode(*values)[source]
Enum representing spherical harmonics ordering modes used by Gaussian splats. Spherical harmonics for Gaussian splatting can be stored differently in memory depending on the application. For example, PLY files store spherical harmonics in
RRR_GGG_BBBorder, while some rendering codes (includingfvdb_reality_capture.GaussianSplat3d) useRGB_RGB_RGBorder.This enum defines two common ordering modes:
RGB_RGB_RGB: The feature channels are interleaved for each coefficient. i.e. The spherical harmonics tensor corresponds to a (row-major) contiguous tensor of shape[num_coefficients, num_sh_bases, channels], where channels=3 for RGB.RRR_GGG_BBB: The feature channels are stored in separate blocks for each coefficient. i.e. The spherical harmonics tensor corresponds to a (row-major) contiguous tensor of shape[num_coefficients, channels, num_sh_bases], where channels=3 for RGB.
- RGB_RGB_RGB = 'rgb_rgb_rgb'
The feature channels of spherical harmonics are interleaved for each coefficient. i.e. The spherical harmonics tensor corresponds to a (row-major) contiguous tensor of shape
[num_coefficients, num_sh_bases, channels], where channels=3 for RGB.
- RRR_GGG_BBB = 'rrr_ggg_bbb'
The feature channels of spherical harmonics are stored in separate blocks for each coefficient. i.e. The spherical harmonics tensor corresponds to a (row-major) contiguous tensor of shape
[num_coefficients, channels, num_sh_bases], where channels=3 for RGB.
The viewer accepts Gaussian splats through the core-owned
fvdb.viz.GaussianSplatViewData tensor contract. Libraries that own a
Gaussian representation can expose an adapter that creates this data object
without copying its tensors.
For callers that already have renderer-ready tensors,
fvdb.viz.Scene.add_gaussian_splat_tensors() is the lower-level entry
point used by fvdb.viz.Scene.add_gaussian_splat_3d().