Tuesday, May 25, 2010

Integrating Vector Data - Roads

You may remember an earlier blog about roads where the approach and algorithms for creating spline based roads were outlined. At that time it was just a concept of how it may work, with many unresolved issues.

In the past weeks I occupied myself with integrating the road system into the engine, making it more robust and powerful on the way. The road way points now contain additional information such as road type, width, marking style and more that will allow to make a variety of road types, also including forest roads with ruts, for example.

As you can see on the following screenshots, the roads are completely integrated into the terrain - no terrain poking through the road surface ever. The integration also modifies the surrounding terrain to make the embedment natural. Side of the road is initially smooth up to a specified border width (can be specified per road spline node), and after that the fractal roughness gradually takes on.



Depressions are filled and an embankment is created.


 Routing the road through a rock or hill makes rocky slopes with defined steepness on the side(s).



More screenshots showing the creation process and the results, with varying level of detail.



The trees are automatically removed from the road surface and its border area, although sometimes you can see branches hanging over the road.


Splines allow for some mad road shapes but it still fits into the terrain :)




Terrain under the road is initially roughly prepared - gaps are filled and excess volume is cut out. This is being done at tile with resolution ~10m, so that fractal algorithm can refine it down naturally. Previously, when the road cut into a hill, the cut was unnaturally smooth. Now only the road border is smooth, gradually transitioning into a rougher fractal structure.

In the following screenshots you can see the process documented:


I. Placing the waypoints - this is currently being done as you move over the terrain pressing a build-road key, later a built-in editor will allow for better editing modes and options.



II. Rough terrain treatment - note this is actually hidden within the process, I've visualized it here just to show what effect it has on the terrain.



III. Finalizing the road




The engine has no problems with terrain resolution (as is apparently the case with many planetary engines), to the extent that asphalt can have actual thickness - I think it's 3cm now (~1.2inch).



Other notable features are
  • vector data are automatically partitioned and indexed in quad-tree managing the terrain
  • overlay dirt textures per road type
  • roads can connect, additional helper code will be needed to adjust the spline points and their attributes so that the connection is smoother
  • the same system is also used for terrain leveling, with or without pavement placing or with gravel surface etc.

Finally the process can be seen on the YouTube video. Original uploaded video was 500MB with good quality, but the recompression step on YouTube reduced it considerably.


The same system is used also for runways, here's a teaser screenshot for upcoming video where Angrypig tries to properly land at .. you can guess where this is from :-)



The corresponding discussion topic on Outerra Forums can be found here
See also the dirt roads
Post a Comment