Examples

Overview

The RaiSim binary distribution ships runnable C++ examples and rayrai tools. Use the example_* executables to exercise RaiSim physics APIs, mesh import/export, OpenUSD mesh loading, and PBR rayrai asset inspection. Use rayrai_raisim_tcp_viewer to inspect applications that publish a raisim::World through raisim::RaisimServer. RaisimUnity and RaisimUnreal are no longer supported.

Overview of RaiSim and rayrai examples

Run

Run examples from the installed package bin directory:

<raisim-install>/bin/example_anymal_contacts
<raisim-install>/bin/example_rayrai_pbr_asset_inspector

On Windows, use the .exe executable from the installed package bin directory:

C:\path\to\raisim\bin\example_anymal_contacts.exe

If the runtime loader cannot find shared libraries, use the platform-specific environment setup before running examples:

source /path/to/raisim2Lib/raisim_env.sh

This script sets LD_LIBRARY_PATH on Linux and DYLD_LIBRARY_PATH on macOS.

.\raisim_env.ps1
raisim_env.bat

Visualization modes

There are two visualization paths. See Visualization for the full workflow comparison.

RaisimServer examples

example_anymal_contacts and example_atlas_contacts create a RaiSim world and publish it through raisim::RaisimServer. They do not open a renderer window themselves. Start rayrai_raisim_tcp_viewer, then run the example:

# Terminal 1
<raisim-install>/bin/rayrai_raisim_tcp_viewer

# Terminal 2
<raisim-install>/bin/example_anymal_contacts

The default server port is 8080 unless the example changes it. Use this path when you want to inspect the same simulation data that a normal RaisimServer application publishes.

Rayrai examples

Examples such as example_polyhaven_blue_wall, example_rayrai_pbr_asset_inspector, and example_rayrai_usd_importer create or use a raisin::RayraiWindow directly and render in process. They do not need the TCP viewer:

<raisim-install>/bin/example_rayrai_pbr_asset_inspector

Prefer these examples when you need camera images, GPU/offscreen rendering, PBR materials, USD/glTF visual import, or standalone rayrai feature inspection.

Non-visual examples

Some examples are intended to print output or create files rather than show a window. example_model_asset_pipeline writes preprocessed and exported OBJ files to /tmp/raisim_model_asset_pipeline_example. example_usd_importer loads OpenUSD mesh assets into a raisim::World and prints mesh counts.

Example layout

The installed package groups examples by executable behavior:

Group

Purpose

example_*

Installed examples for RaiSim physics, mesh import/export, OpenUSD mesh loading, and rayrai asset inspection.

rayrai_*

rayrai tools and standalone renderer examples.

Server examples

Examples that publish a world through RaisimServer and are viewed with rayrai_raisim_tcp_viewer.

Choosing an example

Start with these targets when learning a specific feature:

Target

Demonstrates

example_anymal_contacts

ANYmal standing on ground with PD gains and RaisimServer publishing.

example_atlas_contacts

Atlas contact simulation with a small timestep and RaisimServer publishing.

example_model_asset_pipeline

Mesh preprocessing, content-hash cache reuse, addMesh with processed assets, and OBJ export from a world.

example_usd_importer

Loading OpenUSD mesh assets into raisim::World through World::addMesh.

example_rayrai_usd_importer

Loading the same OpenUSD assets as rayrai visual meshes.

example_polyhaven_blue_wall

Importing a Poly Haven glTF scene with HDR IBL, imported lights, reflection probes, and screenshot command-line options.

example_rayrai_pbr_asset_inspector

Inspecting bundled glTF PBR sample assets under rayrai quality settings.

rayrai_coacd_mesh_approximation

Visually comparing original meshes and CoACD convex approximation parts generated through World::addMesh.

rayrai_feature_showcase

Offscreen image generation for rayrai features, including full scene, depth of field, depth plane, deformables, PBR maps, and HDR IBL.

rayrai_quality_comparison

Preset comparison images and quality reports for rayrai rendering.

rayrai_benchmark

Rendering, readback, scene-sync, and TCP serialization benchmarks.

rayrai_complete_showcase_benchmark

Timed Anymal sensor-showcase benchmark with optional readback, visualization startup, startup profiling, and PBR world materials.

rayrai_pbr_first_draw_benchmark

First-draw and warm-frame benchmark for full PBR and core-eligible PBR shader-material paths.

rayrai_raisim_tcp_viewer

The TCP visualizer used by RaisimServer examples.

Optional targets

Some targets depend on optional assets or platform packages:

  • OpenUSD examples require the package’s OpenUSD runtime and bundled USD files.

  • Rayrai examples require SDL2/OpenGL and rayrai runtime libraries.

  • Poly Haven and PBR asset examples require the corresponding assets under rsc.

List available examples by inspecting the installed package bin directory:

ls <raisim-install>/bin

Current Package Examples

Benchmark Examples

Rayrai Tools And Examples

Server Examples

XML Examples