Experiments with OpenDrive (xodr) map files in the context of osgEarth to blend terrain height data with measured road datasets
Slightly modified versions of COVISE and esmini provide the road meshing and osgEarth is the terrain engine
Changes to COVISE: mostly in Road.h/.cpp and RoadSystem.h/.cpp - see dedicated README for details
Changes to esmini: mostly in roadgeom.hpp/.cpp and around resource path lookup
Files in folder "oe" are derived and combined from osgEarth examples. osgEarthStuff.cpp contains the main part of this experiment
Pros:
- Elevation blending works with OpenDrive data providing the elevation data the terrain aligns to
- Mesh cutout works
- osgEarth terrain LODing works well with road outlines
- Positioning road scene graph so no floating point precision issues in a double precision (64bit) world coordinate system with rendering doing its thing in single precision (32bit)
Cons:
- Elevation blending is jagged due to the grid structure in the terrain mesh - a better approach would be to extend the road cross sections with additional "blend points" of the batter / shoulder / road bed
- Road LODs not good, so performance is bad on large data sets and if many road segments are in view
- Vertical datums probably not implemented correctly
- No bridges or roads crossing each other
- Texturing of roads not working / considered
Prerequisites:
- OSG 3.6.x installed
- osgEarth 3.x installed
- osgEarth source
- esMini source / resource dir
- covise installed / resource dir
Minimal setup: mkdir build && cd build && cmake .. export OSG_DIR=<path_to_osg_install_dir> // e.g. /usr/local export OSG_EARTH_DIR=<path_to_osgEarth_dir> // e.g. /usr/local export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OSG_DIR/lib:$OSG_EARTH_DIR/lib64 ./osgEarthOpenDrive ../simple.earth --odr
Don't expect something working out-of-the-box.
Check osgEarthStuff.cpp line 190 and enable elevation source url or adjust to another source
There are different ways of geo-referencing, the coordinate transformations might be off on your data set, vertical datums can be different, different map providers use different tag names for the same feature, e.g. delineators instead of pole.
I was mostly using a dataset "Testfeld A9" provided by 3D Mapping GmbH in the offset variant. YMMW
Most stuff in here is not written by me, so rights belong to their respective owners.
Credits: osgEarth authors OpenSceneGraph authors EsMINI authors COVISE authors libOpenDrive authors