RoadRunner can export scenes to the CARLA simulator. The CARLA export option exports a Filmbox (.fbx) file, an XML for some metadata, and an OpenDRIVE® (.xodr) file. The XML file holds data for materials in the scene.
On the CARLA or Unreal® side, a plugin is provided to help import the FBX® file by using the information stored in the XML file. The plugin handles the following:
Setting up materials
Material data is read in from the XML file and maps the data into a new instance of one of the base materials included with the plugin.
Certain materials will instantiate from one of the CARLA materials.
Transparent materials will choose between the translucent and masked blend modes based on the transparency of the diffuse color.
Adjusting the colliders in the imported static meshes
During import, newly created static mesh assets have their "Collision Complexity" option set to "Use Complex Collision As Simple".
Setting up the traffic signal visuals
Traffic signal logic is not hooked up to the simulator.
Unreal Version 4.21+
CARLA 0.9.5 built from source
Follow the instructions in this section to install the Unreal plugin:
See Downloading Plugins for instructions for downloading the latest version of the plugin.
Extract the RoadRunner Plugins zip file and locate the "RoadRunnerImporter", "RoadRunnerCarlaIntegration", and "RoadRunnerMaterials" folders under "Unreal/Plugins".
Copy the "RoadRunnerImporter", "RoadRunnerCarlaIntegration", and "RoadRunnerMaterials" folders into the "Plugins" folder under the CarlaUE4 project directory, located at <carla>/Unreal/CarlaUE4/Plugins (next to the "Carla" folder).
Rebuild the plugin.
Generate the project files.
Windows® - Right-click the .uproject file and select "Generate Visual Studio project files."
Linux® - Run this code at the command line:
$UE4_ROOT/GenerateProjectFiles.sh -project="<Path to Carla folder>/Unreal/CarlaUE4/CarlaUE4.uproject" -game -engine
Set UE4_ROOT to your Unreal Engine® install directory.
Open the project and build the plugins by clicking Yes.
The plugin shows up under Edit > Plugins. If it does not appear in that menu, check that the Enabled check box is on.
Overrides the default FBX importer when the metadata file is present
Option to overwrite default materials with new materials using the metadata file
Import signal data and timing
Contains component to control traffic signal visuals
Creates a new map and imports the FBX into the level
Moves static mesh assets based on segmentation type
Creates materials instantiated from CARLA materials for weather effects
Generates the routes from the OpenDRIVE file
Base materials to create instances from
Follow the steps below to export a scene from RoadRunner to Unreal:
Open your scene in RoadRunner.
Export the scene using the CARLA option. Select File > Export > CARLA (.fbx + .xml + .xodr) from the Main Menu.
In the Export CARLA dialog box, set the mesh tiling on the FBX tab and the OpenDRIVE options on the OpenDRIVE tab as needed. Then, click Export.
Browse to open the file dialog box to set the exported file's name and path. The FBX, textures, XML, and OpenDRIVE files are exported to the same folder.
The mesh can be split by segmentation type. Meshes have "<segmentation type>Node" appended to their names.
If the Export To Tiles option is selected, meshes are split per tile and props are grouped by the tile they are in.
By default, only one file is exported. Tiles are stored in separate nodes.
If Export Individual Tiles is enabled, each tile is stored in its own FBX file.
The plugin does not fully support the Export Individual Tiles option.
There are multiple ways to import the scene into Unreal for use with CARLA.
Drag the file into the Content Browser.
Use the "Import" button and select the FBX file.
The plugin checks if there is a RoadRunner XML file associated with the imported file, and imports as normal if a corresponding XML file is not found.
Selecting File > Import Into Level does not use the exported RoadRunner XML and uses the Unreal importer instead.
Overrides the default material importing. Instances from CARLA materials for roads and foliage.
Needs to be unchecked if you want to set the materials to "Use Existing" in the next dialog box.
Import Signal Visuals
Only functional when the "Create one Blueprint asset" option is selected in the next dialog box.
The Importing Signal Visuals option does not have any effect on the traffic simulation.
Set Scene > Hierarchy Type to "Create One Blueprint Asset" (selected by default).
Only the "Create one Blueprint asset" import option works with materials, signals, and transparency sorting. The "Create one Actor with Components" and "Create Level Actors" options import only materials.
Select Invert Normal Maps, if needed.
Set Static Meshes > Normal Import Method to "Import Normals".
(Optional) Uncheck Remove Degenerates, which can help for some props created in a larger scale.
If traffic signals were set up in RoadRunner, they are imported into Unreal as RoadRunnerTrafficJunction components. These controllers are automatically created during import and included in the created blueprint.
The RoadRunnerTrafficJunction component handles the logic for switching between signal states. UUIDs are used to match to specific game objects in the scene.
The FBX file will automatically split the mesh by segmentation and transparency sorting layer due to the following:
Segmentation: CARLA determines segmentation by static mesh assets.
Transparency sorting: Unreal stores the "Translucency Sort Priority" value on the static mesh component.
Click Play in the editor (the first time you click Play takes extra time to build the map).
Run the example Python® scripts.
Some steps in CARLA have changed since the 0.9.5 release of CARLA, but the same concepts should apply if there are issues.
Import the FBX into UE4 by using the plugin.
Run this command:
make export-maps ARGS="--file=<map
If the map uses RoadRunner materials, you will likely get a missing material error when trying to run the executable. Follow the steps in the next section if this issue occurs.
Since CARLA scripts do not copy the RoadRunner plugin "Content" folder, they need to be generated and copied manually to the distribution build.
In UE4, open the packaging settings under File > Package Project > Packaging Settings.
Uncheck "Use Pak File".
Add the map you want to package to the "List of maps to include in a packaged build."
Run this command:
Copy the cooked plugin content (located at <carla>/Dist/0.9.5-dirty/LinuxNoEditor/CarlaUE4/Plugins/RoadRunnerImporter) to the desired location.
This procedure generates only the materials used in the included maps.