Skip to content
esc
Start typing to search the docs
Navigate Open

Implement custom visualizations (Rust only)

There are three ways to extend the Rerun Viewer with custom Rust code, depending on how deep you need to go: embedding custom UI panels alongside the Viewer, adding a custom visualizer to a built-in view, or implementing an entirely new view class.

Embedding custom UI in the Viewer

The Rerun Viewer, extended with a custom panel to the right

In the above screenshot you see the example extend_viewer_ui, which contains the Rerun Viewer to the left and a custom panel to the right. In this example the panel contains a hierarchical text view of the loaded data.

How to build it

The Rerun Viewer is defined by the crate re_viewer. It uses the Rust GUI library egui and its framework eframe. To extend the UI you need to create your own eframe application and embed re_viewer inside of it. You can then use egui to add custom panels and windows.

The best way to get started is by reading the source code of the extend_viewer_ui example.

To run your custom Viewer in a browser, compile it to WebAssembly. See Building for the web for how we build the Rerun web viewer.

To react to Viewer events (selection, time changes, …) from your own app, see the viewer_callbacks example and React to events in the Viewer.

Bevy and other game engines

There is no maintained Bevy integration. To visualize data from a Bevy app, log it with the Rust SDK like from any other Rust program. Revy is a proof-of-concept that snapshots the Bevy ECS into Rerun every frame.

Custom visualizers for built-in views

Rerun Viewer 3D view with a custom HeightField visualizer rendering a color-mapped terrain, its settings shown in the selection panel

You can register custom visualizers with existing built-in views (such as the 3D Spatial View) without having to implement an entire view class from scratch. This is the right approach when your data fits naturally into an existing view but needs custom rendering. A custom visualizer typically consists of a custom archetype, a visualizer system, and optionally a custom GPU renderer.

The custom_visualizer example demonstrates this by adding a GPU-rendered heightfield to the built-in 3D Spatial View. See its README for a detailed walkthrough of the three parts involved.

Custom view classes

The Rerun Viewer, extended with a custom View that is shown three times, each time showing points on a colored plane

If you need a completely new kind of view (not just a new visualizer within an existing view), you can implement a custom view class.

The custom_view example demonstrates how to add a fully custom View class to Rerun on startup. Views that are added this way have access to the exact same interfaces as all other Views, meaning that any of the built-in Views can serve as an additional example on how to implement Views.

The best way to get started is by reading the source code of the custom_view example.

Limitations

Extending the Viewer UI is only possible from Rust. You cannot embed your own GUI widgets inside existing views, and blueprints cannot add UI elements with callbacks. See #3087 for the state of Viewer extensibility.