Open Street Map Data + Unity3D = Procedural Cities

Open Street Map Data + Unity3D = Procedural Cities

Whats this?

Simply put, using Open Street Map data we have generated entire cities with the Unity engine.

Buildings are generated from its footprint data and then extruded up to their correct height thanks to the Open Street Map data. Ideally, we would have entire building plans, but that doesn’t look like it’ll be possible any time soon. The roads are also generated from the data, their different sizes and colors represent the type of road.

Finally, the meshes are simplified and we add post-process image effects to the final result. Let us know what you think!

Challenges

Currently I’m reading in the entire XML file into memory (inefficient really, I’ll look into streaming that in at a later date) due to nodes referencing one another.

Generating the meshes on the Unity thread was taking far too long, around 40 – 50 seconds for a small town. I sped this up by offloading the mesh creation to a separate thread, which then throws the completed mesh back to Unity for rendering. This sped up the load time to around 15 seconds for large cities and 3 – 4 seconds for small ones. I could further optimize this with the roads, which are actually formed with particles; however, there hasn’t been any need for that so far.

Future Plans

Looking forward with the project I plan on adding in cars along the roads and the ability to click on individual buildings to receive their floor plans. However that is far off into the future, I’m very happy with how this has turned out so far so I’m just going to leave the project where it is until I find myself in a creative slump again.