Automatically generate a map from RoadRunner

Important

The given scripts only works if the files are kept in the folders detailed below.

This script is aimed to reduce the time needed to setup a map inside Carla's project. Also, in combination of the import / export scripts will allow the user to generate a simple map without opening Unreal Engine.

Important

The script does heavy use of Unreal's capabilities, so it is needed to be installed and setup, as the import fbx action is done directly over the code project, not a distribution build.

How to import a fbx

The current script only work for files placed with the follow structure (RoadRunnerFiles is located in the root folder):

RoadRunnerFiles/
├── MapToImport01
│   ├── Asphalt1_Diff.png
│   ├── Asphalt1_Norm.png
│   ├── Asphalt1_Spec.png
│   ├── Grass1_Diff.png
│   ├── Grass1_Norm.png
│   ├── Grass1_Spec.png
│   ├── LaneMarking1_Diff.png
│   ├── LaneMarking1_Norm.png
│   ├── LaneMarking1_Spec.png
│   ├── MapToImport01.fbx
│   └── MapToImport01.xodr
└── MapToImport02
    ├── Asphalt1_Diff.png
    ├── Asphalt1_Norm.png
    ├── Asphalt1_Spec.png
    ├── Concrete1_Diff.png
    ├── Concrete1_Norm.png
    ├── Concrete1_Spec.png
    ├── Grass1_Diff.png
    ├── Grass1_Norm.png
    ├── Grass1_Spec.png
    ├── LaneMarking1_Diff.png
    ├── LaneMarking1_Norm.png
    ├── LaneMarking1_Spec.png
    ├── MapToImport02.fbx
    └── MapToImport02.xodr

Under RoadRunnerFiles folder located at the Carla Root, place each "Export" folder obtained from RoadRunner and rename it with the name of the map to be imported. It have to match the .fbx and .xodr files.

Now, simply go into the "Util" folder and run generate_map.py

Important

The script, by default, checks the /Unreal/CarlaUE4/Content/Carla/ExportedMaps for matching names. If a map with the same name as a to-be-imported map is found, it will notify the user and won't do anything. To override this, generate_map.py can be invoked with the --force flag.

After the script finishes, all a map with the same name of the folder and files will be located under /Unreal/CarlaUE4/Content/Carla/Maps with all the static meshes and placed, textures, waypoints and routes generated.

Important

There is a bug in RoadRunner that generates wrong materials automatically and they get broken inside Unreal. By adding the flag --usecarlamats the meshes will use the materials provided by Carla's project, that will also react to the weather.