Note: This is my first attempt at solving this problem. If I find a smarter way to do this, I will update this page.
I wanted to be able to create roads for a landscape in Unreal using external data so that I can modify the roads just by updating the data. This was a bit more complicated than I thought, which is why I created this page so that others might find help here.
The splines are created in Houdini and exported as a csv file, containing only x, y, z positions and the number of points pr. curve (yes, I know this could be done a bit more memory saving by storing that data in a separate file but I reckon the use of csv should be the first concern regarding space and speed ;-), so fuck it for now, I’ll deal with that later).
In Unreal I created a data structure to support the curve data.
Finally, I created a blueprint and in the constructor, I loop through the curve data and build the splines. I don’t care too much about the speed here as it is only run once on startup.
When the curves are created, the road geometry is added. It is important that the geometry is created after the splines have been completely created, otherwise each section will not be streched to meet the next.
The eagle eyed observer might have spotted that I add 2 different geometries to the spline sections. I’ll explain that in another post.