Visualization

RaiSim has two current visualization workflows. Choose the workflow based on where rendering should happen.

Workflow

Use it when

Main executable/API

RaisimServer + TCP viewer

Your simulation should publish world state and a separate viewer should display it.

raisim::RaisimServer and rayrai_tcp_viewer

In-process rayrai

Your application needs direct access to OpenGL textures, RGB/depth images, screenshots, PBR assets, or custom UI embedding.

raisin::RayraiWindow

For older Unity or Unreal workflows, see Legacy Integrations.

RaisimServer + TCP Viewer

This is the simplest way to inspect a simulation while keeping the renderer out of the simulation process. Your application owns the world and starts a RaisimServer:

raisim::World world;
raisim::RaisimServer server(&world);
server.launchServer(8080);

while (running) {
  server.integrateWorldThreadSafe();
}

Start the viewer from the same source build in one sourced terminal:

source ./raisim_env.sh
./build/examples/rayrai_tcp_viewer

Then run a server-based example in another sourced terminal:

source ./raisim_env.sh
./build/examples/primitive_grid

The viewer connects to port 8080 by default. Use this workflow for normal debug visualization, object inspection, and interactive camera control.

Important boundary: the TCP viewer only receives world state. It does not render RGB/depth frames back into RaiSim sensors. For RGB/depth sensor buffers, prefer in-process rayrai with Sensor::MeasurementSource::MANUAL. Use RaiSim-side CPU depth only when rayrai is unavailable or a deterministic headless ray-query fallback is explicitly required.

In-Process rayrai

Use in-process rayrai when rendering is part of the application:

auto world = std::make_shared<raisim::World>();
raisin::RayraiWindow viewer(world, 1280, 720);

while (running) {
  world->integrate();
  viewer.update(1280, 720, false, 0, 0, false);
  unsigned int colorTexture = viewer.getImageTexture();
  (void)colorTexture;
}

Examples:

source ./raisim_env.sh
./build/examples/rayrai_basic_scene
./build/examples/rayrai_pbr_material_grid
./build/examples/rayrai_pbr_texture_maps

Use this workflow for screenshots, offscreen rendering, dataset generation, custom ImGui/Qt tools, PBR visual inspection, glTF visual import, picking, and direct RGB/depth readback.

Which Page Next?

  • Raisim Server documents the server lifecycle, thread-safety boundary, synchronous request loop, and server-side visual helper API.

  • rayrai Visualizer documents RayraiWindow, render-quality controls, custom visuals, glTF/Blender import, offscreen contexts, sensors, and rayrai API reference.

  • Sensors documents the recommended rayrai RGB/depth sensor workflow, manual sensor buffers, and CPU-only fallback paths.