This is a free bit of code/tutorial for people who want to know how to import real world data into Unity. You will notice there are several packages about that are quite costly. But here I show you how do that for free.
Import real world terrain into Unity with 2-3 mouse clicks. Downside of this project is that free online WMS (Web Mapping Services), isn’t so common anymore and the only free ones have LOW RES terrain (maybe you can still use it for a flight sim). If we could re-wind to 2011 it would be a different story with NASA worldwind (better than Google earth and open source), but unfortunately they couldn’t afford to keep servers up.
If you want you can setup a WMS to run on your hard drive instead and acquire a data set from somewhere like USGS, that would be a better solution. You can buy the DVDs of data really cheap or just download it for free (takes a while cause the dataset is huge - terrabytes). Then you can have much higher res data.
So I am still not happy with no good online WMS so I have made a Bing Maps one, that will be free too, in fact its against the rules to sell the data. You will have high res data to download. Bing Maps API uses JSON, a bit more of a current approach. I will upload if anyone is interested.
All the source code is included, just download the zip, unzip it into your project and then a menu called “TerraNator” will appear.
Just drag the white box over the region of interest then click download button.
But there are some problems.
You can’t use namespace for Monobehavior scripts.
So :
namespace SmellyDogs
{
public class TerraNator : EditorWindow
}
throw error :
Instance of TerraNator couldn't be created because there is no script with that name.
UnityEditor.EditorWindow:GetWindow(Type)
SmellyDogs.TerraNator:CreateWindow() (at Assets/TerraNator/TerraNator.cs:54)
And : window.maximized = false; // Doesn’t exist in unity < 4.2. use IF_DEF UNITY_4_2
I should point out this ran fine on Unity 4.1 (if Unity did indeed remove that method then…wow…what can I say).
But theres no monobehaviors here, so the namespace is fine (he says, using 4.1 here).
Yes we need to be careful not to break any license agreements with Bing. In short I’m not clear if you can use this data for your games, unless you buy a commerical license. Its probably ok to use for free stuff. With my free license it prints a big “copyright” embedded into the textures so that’s a clear indication.
As far as storing files locally goes, I don’t see anywhere where it says that you cannot do that, which would be a little odd anyway because their API serves data direct to your HD. Although I have seen people writing that it breaks the agreement, it seems to refer to offline usage rather than using a local storage. So yes you are probably correct that you couldn’t use Bing for games without a special license.
Uh, WMS only gives you textures, so your terrain is 2D. Am I missing something important here? Even for a flight sim, in the 21st century you’d want 3D terrain (mountains at least).
Technically you want WCS but there’s no reason a WMS cannot serve heights, e.g. Geotiff, greyscale heights, whatever - its just a raster the same as a map, you just need to interpret the data differently. In this case height is just inferred from GTOPO30.
Was trying to get this too work. In my project folder, I have several folders. Do I just drop it in the project’s root directory or into Assets or what? I’m using the latest version of Unity. Even if I have to modify the source, it’s fine with me, I’m just not getting thse files to register at all.
Can someone has has successfully imported theses files point me in the right direction?