Introduction to visualization
Learn how the Visualizations subsystem turns ROS messages into 3D geometry or HUD panels.
Simulation Pro ships an RViz-like Visualizations subsystem that subscribes to ROS topics and draws the messages it receives, either as 3D geometry in the scene or as 2D panels in the HUD. Use it to inspect sensor data, robot state, and other ROS topics directly in the Unity Editor, instead of writing custom rendering code for every message type.
The runtime code lives in Runtime/Foundation/Visualizations/ (assembly Unity.SimulationPro.Foundation.Visualizations, namespace Unity.SimulationPro.Foundation.Visualizations), with built-in visualizers under DefaultVisualizers/, a low-level drawing utility under Drawing3d/, and worked examples under ExampleVisualizers/.
How it fits together
The subsystem sits on top of the messaging layer: every visualizer ultimately subscribes to a topic through an IConnector (obtained via ConnectorInjector.FindConnector). A message arrives, and an IVisual renders it as geometry or a texture.
There are three core roles:
IVisualFactory: knows a message type, creates and owns oneIVisualper topic, and reports whether it supports 3D output viaCanShowDrawing.IVisual: the per-topic object that subscribes, stores the last message, and renders it. It exposesIsDrawingEnabled,SetDrawingEnabled(bool),Redraw(), andOnGUI().VisualFactoryRegistry: a static registry that maps topics and message types to their highest-priority factory, per connector.
The factory and registry pattern
Factories register themselves with VisualFactoryRegistry, keyed by connector. You can register per topic or per message type, and a priority int breaks ties (higher wins):
// type-wide: applies to every topic carrying this message type
VisualFactoryRegistry.RegisterTypeVisualizer<PoseMsg>(connector, factory, priority: 0);
// topic-specific: applies only to this topic
VisualFactoryRegistry.RegisterTopicVisualizer(connector, "/robot/pose", factory, priority: 0);
Lookup (GetVisualFactory(connector, topic, messageTypeId)) prefers a topic-specific factory, then falls back to a type registration, and finally to a built-in ToStringVisualizer that just prints the message — so every known message type has a visualization, even without a dedicated one.
Most factories derive from BaseVisualFactory<T>, a MonoBehaviour you drop on a GameObject. It reads a serialized Topic field (leave it empty to register as the type-wide default) and registers itself in Start(). Subclasses only implement CreateVisual(string topic) and CanShowDrawing.
Several ready-made base classes build on BaseVisualFactory<T>:
| Base class | Purpose |
|---|---|
DrawingVisualizer<T> |
Renders a message into a Drawing3d canvas; override Draw(Drawing3d, T, MessageMetadata). CanShowDrawing => true. |
DrawingVisualizerWithSettings<T, TSettings> |
A DrawingVisualizer<T> backed by a ScriptableObject settings asset (used by LiDAR, point cloud, joy). |
HistoryDrawingVisualizer<T> |
Buffers the last N messages and draws them together; override Draw(Drawing3d, IEnumerable<T>). |
TextureVisualizer<T> |
Converts a message into a Texture2D for 2D display; override CreateTexture(T). CanShowDrawing => false. |
GuiVisualizer<T> |
Renders an IMGUI panel only; override CreateGUI(T, MessageMetadata). CanShowDrawing => false. |
To turn a visualization on or off once it's registered, refer to Enable visualizations. For the catalog of visualizers Simulation Pro ships out of the box, refer to the Built-in visualizer reference.