In one of my personal projects I wanted to see Uppsala, the city I live in, in 3D. Those who know me know I am a Blenderhead, a Blender die hard fan for reasons I will discuss at some time. But now, how can yo do it by yourself with your own city?
This was really hard to find, specially open, but I love open stuff and there is OpenStreetmap where you can export an OSM (openstreetmap) file which is some sort of XML file with a lot of information, including where trees and buildings are.
To export a place go to OpenStreetMap and explore, then click export and you will get the longitude and latitude borders of your area. If the area is to big you will have a very big file! obviously! so be careful.
After you get your OSM file you need to convert it to something to open on Blender.
Some german hero created a software called osm2world that can convert OSM to OBJ which is a format that Blender can open. I found it a tad difficult to use but it’s amazing that it has java executables for any operative system, mine is Linux (obviously).
I run it in a console using
java -Xmx2G -jar OSM2World.jar -i input.osm -o output.obj
And it’s as easy as that now you have an OBJ that you can open in Blender like this:
But of course it is not all puppies and rainbows, buildings might not be perfectly modeled and color can be lost, and there is a clutter of things that I didn’t want to see, I don’t care about little benches or traffic lights and many more things that were not correctly placed, not correctly modeled and don’t really add much since I won’t be visiting with that level of detail. I just wanted a panoramic view.
So how do you get rid of all these things? depending on how big of an area you exported, you might get different amount of things, maybe you don’t need to clean. But I did and I will show you how and if you want to do it too, I will give you my code.
What is OBJ
Wavefront .OBJ is a way to save meshes (vertices, edges, faces and color) in plain text, you can open it in a text editor and see what is inside. You can group vertices and edges and name these groups as something recognizable, that you could delete. But given the organization of the file you can’t just delete the text you have to rearrange all the vertices and edges and faces which was an absolute nightmare for me.
Wonderful people who believe in open source create software every now and then that can do things like this, but sometimes they are overkill for a small task, sometimes they don’t work as you intended and I am all up for programming my own things, be them complex or simple. So I made a script that finds all objects, removes all the undesired objects by name and then rearranges all the vertices again and produces a clean OBJ to import in Blender. Mind you, it’s not perfect and could be better but it worked for my purposes so that’s the end of it. You can find the code here.
So now can I see my city please? Yes sure, here it is, ugly buildings and all.
Playing with Blender and architecture
I will not be teaching you Blender here but if you invite me a coffee I might tell you about it. How ever if you are not seeing all your city it might be that you need to expand your view in Blender if the city is too big you can do this in a menu that appears pressing N or by dragging a little cross in the upper right side of the viewport, here you can select to clip the view at a larger distance.
So to model the cathedral (which was a hard task) I wanted to find real blueprints of the building and it was tough because I had to do ti in swedish (which I do not yet master) but a friend helped me by giving me some tips. She works in digital humanities so she knows her stuff.
She told me to search in ALVIN which is a platform for digital collections and digitized cultural heritage. I searched in Alvin and in google for the words
Uppsala domkyrka, domkyrkoarkitekt, ritning, planritning
And eventually found some good examples:
So my recommendation becomes to know where to search for blueprints and historical archives and speak the language of where you are searching history from.
Anyways, I played with the depth of field with the f-stop the focal length and placing the camera around and with a simple white material on everything I made these two things.