Spatial3DView

For viewing spatial 3D data.

Properties properties

background background

Configuration for the background of the view.

  • kind: The type of the background.
  • color: Color used for the solid background type.

line_grid linegrid

Configuration for the 3D line grid.

  • visible: Whether the grid is visible.
  • spacing: Space between grid lines spacing of one line to the next in scene units.
  • plane: In what plane the grid is drawn.
  • stroke_width: How thick the lines should be in ui units.
  • color: Color used for the grid.

time_ranges timeranges

Configures which range on each timeline is shown by this view (unless specified differently per entity).

If not specified, the default is to show the latest state of each component. If a timeline is specified more than once, the first entry will be used.

Example example

Use a blueprint to customize a Spatial3DView. use-a-blueprint-to-customize-a-spatial3dview

"""Use a blueprint to customize a Spatial3DView."""

import rerun as rr
import rerun.blueprint as rrb
from numpy.random import default_rng

rr.init("rerun_example_spatial_3d", spawn=True)

# Create some random points.
rng = default_rng(12345)
positions = rng.uniform(-5, 5, size=[50, 3])
colors = rng.uniform(0, 255, size=[50, 3])
radii = rng.uniform(0.1, 0.5, size=[50])

rr.log("points", rr.Points3D(positions, colors=colors, radii=radii))
rr.log("box", rr.Boxes3D(half_sizes=[5, 5, 5], colors=0))

# Create a Spatial3D view to display the points.
blueprint = rrb.Blueprint(
    rrb.Spatial3DView(
        origin="/",
        name="3D Scene",
        # Set the background color to light blue.
        background=[100, 149, 237],
        # Configure the line grid.
        line_grid=rrb.archetypes.LineGrid3D(
            visible=True,  # The grid is enabled by default, but you can hide it with this property.
            spacing=0.1,  # Makes the grid more fine-grained.
            # By default, the plane is inferred from view coordinates setup, but you can set arbitrary planes.
            plane=rr.components.Plane3D.XY.with_distance(-5.0),
            stroke_width=2.0,  # Makes the grid lines twice as thick as usual.
            color=[255, 255, 255, 128],  # Colors the grid a half-transparent white.
        ),
    ),
    collapse_panels=True,
)

rr.send_blueprint(blueprint)

Visualized archetypes visualized-archetypes