Skip to content

rerun-io/extend_without_forking

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Extend without forking (custom SDF visualizer)

extend_without_forking.mp4

This example demonstrates how to extend the Rerun Viewer with custom visualization capabilities without needing to fork the internal codebase.

Specifically, it implements a Signed Distance Field (SDF) visualizer. The example defines a custom archetype, a visualizer to handle the data, and a custom GPU renderer to draw the SDF in a 3D spatial view.

The code for this example was generated by the prompt:

Using Rerun 0.30.0 it is possible to "extend existing 
views without forking" which you can read about here: 
https://github.com/rerun-io/rerun/releases/tag/0.30.0. 
There is also an example of how this can be done here: 
https://github.com/rerun-io/rerun/tree/latest/examples/rust/custom_visualizer.

I want you to make something similar to the
custom_visualizer in the second link. However, instead 
of showing a height field, I would like you to create a 
custom signed distance field visualizer. Other than that, 
keep it similar to the custom_visualizer.

Later, the prompt was changed to fix a bug and add animation. The video above shows the process of how the custom SDF visualizer was created.

Resources

Features

  • Custom Archetype: SignedDistanceField, which stores a 2D grid of f32 values.
  • Custom Visualizer: Interprets the SDF data and prepares it for rendering.
  • Custom GPU Renderer: A specialized shader-based renderer that draws:
    • Blue: Inside the shape (negative SDF).
    • Red: Outside the shape (positive SDF).
    • Yellow: The zero-level boundary (the isosurface).
    • Dark Lines: Equidistant isocurves for visual depth.
  • Live Animation: Continuously streams SDF frames to show real-time updates.

How It Works

  1. Archetype (sdf_archetype.rs): Defines the data structure that Rerun's SDK and Viewer understand.
  2. Visualizer (sdf_visualizer.rs): Acts as the bridge between the logged data and the renderer. It queries the SignedDistanceField data from the Rerun database.
  3. Renderer (sdf_renderer.rs): Uses WGPU to implement a custom rendering pass that draws the SDF on a mesh.
  4. Extension (main.rs): Registers the custom visualizer into the standard Spatial3DView using app.extend_view_class.

Running the Example

Make sure you have Rust installed.

cargo run

This will launch a custom Rerun Viewer and immediately start playing a live SDF animation of blending circles and shapes.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages