Skip to content

brifsttar/OpenDRIVE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unreal Engine OpenDRIVE plugin

This plugin allows you to manipulate your OpenDRIVE road network in Unreal Engine. It is built around esmini's RoadManager, which does most of the heavy work. I encourage you to check out this project, which also includes OpenSCENARIO support.

Installation

RoadManager is included as a submodule to this repository, so make sure to initialize and update submodules. For example:

git clone --recurse-submodules https://github.com/brifsttar/OpenDRIVE.git

Currently, this plugin supports Windows only. For Linux support, it is being discussed in #8.

The plugin's master branch works for UE5. If you need UE4 support, you can use use the ue4 branch (tested on 4.26+).

For CARLA users: due to conflicting classes name, the plugin doesn't work as-is alongside CARLA. The simplest workaround is to delete this plugin's ATrafficLightController class to remove the conflict.

Disclaimer about coordinate systems

OpenDRIVE uses a right-handed coordinate system, whereas Unreal Engine uses a left-handed coordinate system. To convert between those, the plugin assumes X and Z are common, and Y is flipped.

This assumption can differ from the one made by various other tools provider. For instance, Mathworks' RoadRunner instead maps OpenDRIVE's (X, Y) axes to Unreal Engine's (Y, X). In this case, it means there ends up being a 90° rotation mismatch along the Z axis between a mesh and an OpenDRIVE file both exported from RoadRunner. The easiest workaround for this is to rotate the imported scene's root actor -90° around the Z axis in Unreal Engine.

How to use

There are a few steps to follow before jumping into the features.

Import the OpenDRIVE file

The plugin adds a new OpenDRIVE asset type, meaning you can (and should) import your .xodr file into the engine. The import process is similar to all other types of assets, so the official documentation should be able to guide you.

Change your default World Settings class

Since OpenDRIVE files are tightly linked to their related scenes, the current workflow is to set the OpenDRIVE asset used for each world/level. To do that, you have to use the plugin's own World Settings class.

This is done by adding the following to your DefaultEngine.ini.

[/Script/Engine.Engine]
WorldSettingsClassName=/Script/OpenDRIVE.OpenDriveWorldSettings

Add the OpenDRIVE file to your level

Once you've set the plugin World Settings class as default, you can open or create a level, and set its OpenDRIVE Asset via a property in the World Settings tab.

OpenDRIVE World Settings

Once that is done, your OpenDRIVE file should be properly loaded, and you can start using the plugin's features, or add your own using the full power of esmini's RoadManager.

Features

OpenDRIVE Viewer

OpenDRIVE Viewer

You can visualize your OpenDRIVE network using the plugin's OpenDRIVE Editor Mode, accessible from the Editor Mode menu. In this mode, you can select individual lanes and get access their OpenDRIVE information (e.g., connection, ID).

OpenDRIVE Position

OpenDRIVE Position

The OpenDRIVE Position object can be used to manipulate OpenDRIVE coordinates, and convert back and forth with Unreal's coordinate system.

OpenDRIVE Vehicle Component

OpenDRIVE Vehicle Component

The OpenDRIVE Vehicle component can be attached to WheeledVehicle and provides some metrics commonly used in driving simulation.

OpenDRIVE Reader

OpenDRIVE Reader

This small editor Blueprint actor automatically updates its track coordinate when moved around the scene, making road and junction identification much easier.

OpenDRIVE Spline

OpenDRIVE Spline

A basic spline with an added feature to align all spline point to their lane center. Useful to create car trajectories.

Junction Spawner

Junction Spawner

This Blueprint can spawn any actor (usually signs or traffic lights) for all roads incoming to a junction. You can also set offsets on the sign's track coordinate.

No signs (or any prop) are included in this plugin. But you can check out Der Sky's Marketplace products, which probably has what you need.

Landscape Sculpting

Landscape Sculpting

This Editor Utility Blueprint automatically sculpts your selected landscapes based on your OpenDRIVE roads. You can set the falloff, the height offset and the layer to paint under roads.

This feature doesn't include drawing the actual road network, it only sculpts the landscape to perfectly fit along the roads. In the video above, the road network was generated using RoadRunner

Known limitations:

  • Sculpting can miss parts of the landscape in junctions, leaving spikes. Those can be manually removed with standard sculpting tools
  • Layer painting won't remove foliage from the previous layer. It seems to be an Unreal Engine bug, and the current workaround is to manually apply a single paint touch to each landscape grid unit, which will instantly remove all foliage on painted roads for that grid unit.

Road Decal Spawner

Road Decal Spawner

This Blueprint can randomly spawn a selection of Decal on the drivable lanes; ideal for placing asphalt defects, tar lines, oil splats, etc.

No material are included with the plugin, but many can be found for free on Quixel.

Duplicate Actor Along Road

Road Duplicate Actor

This Editor Utility Blueprint allows any actor to be duplicated along any road at a fixed step. The process runs until it encounters a junction, so it can actually span multiple roads.

For this to work, actors are assumed to use the standard Unreal Engine alignment (X+ forward, Z+ up), except Decals, for which Y- forward and X- up are expected.