There are many instances where creating a map can be quite challenging, especially if you want to make it as believable as possible, so what's the best way of getting a believable terrain? Simple, take it from a reputable source and you're living on it right now, our Earth.
There are a number of ways of getting data from our Earth and the best way I have found comes with a combination of Google Earth and SRTM data. NASA and various other companies create SRTM data to get the full geology of the Earth, this data varies in detail globally though you can expect details of height data from 300 metres to 5 metres. The SRTM has the height data already for you to use however Google Earth contains the map in which you would want to use. With them being separate it makes things a little difficult to align so there's a little trick to get this to work. With this tutorial, I will show you what software you will need and how you can get a map of anywhere in the world into the Unreal Engine 4.
First, you will need to download and install the following software:
- Unreal Engine 4
- Google Earth
- MicroDEM 64bit
- An image editor like Photoshop or GIMP
Next, you will want to bookmark the SRTM data page. There used to be an SRTM plugin for Google Earth but that hasn't worked for a couple years now because the server no longer works, the archive from the SRTM is located on the data page which makes things handy, but the problem now is how do you know which data to go for? Well, this will be easier than you thought.
So firstly let’s boot up Unreal Engine 4 and create a default level so that you have a light source already. Delete the floor and then you will be ready to start everything.
The first thing that needs to be done before we can get any data is to work out the size of the area we want. In the Modes Panel go to the Landscape mode and create the terrain size that you want. In this tutorial, I will be wanting to have a 2x2 kilometre terrain. Unreal Engine 4's units are 1 unit = 1 centimetre, this makes things extremely easy to calculate, so 2km = 2000m = 200000cm. The terrain, however, works in resolutions, the overall resolution that you will most likely get is 2017x2017 which equates to 2017m. To get this I set the section size to 63x63, the sections per component to 1x1, and then just hit “fill world”, this should just give you 32x32 components and the 2017x2017 resolution. Now click the Create button and you will have your terrain created.
You should now get what seems like a huge plane with the default material applied to it, also you will automatically be placed into Sculpt mode, but don't use that now! As we now know the size of the terrain in metres (2017x2017) we need to find an area in the world where we can take and import it. So now we need to load up Google Earth.
I will be using an area in my hometown for this tutorial though you can use any place you like instead. What we need to do is draw out an area where we want to take the data from so use the “Add Path” tool and draw a square like I have done here. Then once you have that square it will most likely not be accurate at all. This will never be perfect so it's best to make it as approximate as possible. Now select the Ruler option and drag out a line from the top left to the top right making sure that you have meters set and also that you try and keep to 90 degrees as much as possible. I have set the ruler length to 2030 metres so when it comes to editing the image I can simply crop it to the size I want it at. Now right click the "untitled path" that is now showing under "My Places" on the left bar and go to properties, it will allow you to start editing the path you made before. Move the top two points as close as possible to the ruler ends then click OK, try not to move the ruler ends as they're also paths.
Back to the ruler and go from the bottom left to the bottom right, then drag the top ruler end to align as close as possible to the top left corner, then drag the bottom ruler end so that it is as close to 0/360 degrees and as close to 2030m as possible. Head back to the properties for the Untitled Path and align the bottom left to the bottom of the ruler end as much as possible. Repeat this process for the bottom and right side of the path and you should get something very close to a square. You can make it very accurate by zooming in and out but if you want to make approximations only rather than make real perfect data then it doesn't matter too much.
Now that we have the square we need to find the real world coordinates for the area, this will be longitudinal and latitudinal coordinates that can be found in the bottom right with an N and W. What we want is the first two numbers of both the North and West, in the case of this area it is 51N and (0)3W / (0)4W. As there are two different West coordinates splitting the map it means that I will need to download two SRTM data files.
Go to the SRTM data page and as the town is in the UK I know that I will be wanting the Eurasia directory. In here there are files named NxxWxx.hgt.zip. These are the heightmaps associated with the area of the world the data is taken from. I will need to download the N51W03 and N51W04 files. Once your files are downloaded then simply extract the HGT file.
As we know the area of the map we want already we just need to know the area of the heightmap that we need, to do this we will need to bring the HGT file into Google Earth, the problem is is that Google Earth does not read HGT files so there is another nifty programme to do that for us. MicroDEM allows you to read the HGT file and transpose it into Google Earth. So open up MicroDEM and install the missing plugins if there are any and then go to File -> Open -> Open DEM, then select the HGT file(s) and they should up.
If you get a black grid show up then what you need to do is click the grid looking icon on each of the maps and under Show choose the option Neither, this will remove the grid lines. On the same toolbar, a few icons to the right of the grid icon is an Earth icon with a black background, you need to click this icon for each of the maps, this will overlay them in Google Earth. If done correctly you should get something similar to the following:
To the left of the search bar you have new “Temporary Place(s)”, right click it and go to the properties and change its Transparency all the way to Opaque. Zoom into the squared path, press F11 to go to fullscreen so that you can get as much detail as possible, make sure no text is in the way and hide the toolbar, the status bar, and everything that's checked in the View menu (but keep the sidebar), hold the right mouse button and push up on the mouse until the map doesn't rotate any further, then click the N on the compass at the top right, you should now be set to take an image from Google Earth. Press ALT+PrtScn (Print Screen) and open up an image editor, paste the image into the editor and leave it open. Go back to Google Earth and make sure NOT to move from the spot, uncheck Temporary Places in the sidebar and then ALT+PrtScn and paste it into an image editor.
If you pasted the Map and the Overlay into the same image then you are already halfway there. Using the Crop Tool hold Shift so you get a 1:1 crop and crop as close to the white lines as possible (preferably on top). Once cropped you will now have both the map and the overlay in the exact position you want it. If you remember that we made the square 2030x2030m, so what we need to do now is to make the image 2030x2030 pixels, this will make the next part even easier. To make the area 1:1 with the Unreal Engine terrain we now simply need to crop the image again to 2017x2017, This will now be as close to accurate as you want the map to be in Unreal Engine 4.
Save the image as map.psd (or any other layer based format) so that you have a backup, then hide all layers other than the map and save it as map.jpg, next hide the map layer and unhide the Overlay, don't save this as a PNG yet as it needs to be converted to greyscale. In Photoshop it is Image -> Adjustments -> Black and White. Now the image can be saved as height.png, Unreal Engine 4 can only read heightmaps that are black and white as well as being PNGs.
We now have our terrain, the colour map and the height map. Go back into Unreal Engine 4 and select the Terrain if it isn't already, in the modes panel select Sculpt and go to the bottom, right click Heightmap and go to Import and choose the greyscale PNG, if done correctly you should get your landscape transform right before you like I have here:
To see how it all looks with the map on top we first need to import the map. Simply drag the image into the content browser and then right click on the imported map and select Create Material. If you drag the new material onto the terrain you will see the map now used however there is a problem, it comes out in tiles! 20117x2017 tiles of it which aren't right so to fix this double click on the material to bring up its properties. You will be shown a screen with a Texture Sample and a map_Mat. What we need to do is drag out from the UVs slot on the Texture Sample and type in LandscapeLayerCoords. Select the new node and in the Details pane, under Mapping Scale change the value to 2017 then click Apply on the top of the window.
Once you have done that close the window and you should now see that the terrain now has its colour map covering the whole thing and not tiled.
Obviously, this won't be perfect and the lower the resolution of the heightmap then the more inaccurate it will be. As I know this map off by heart I can most certainly see a lot of places where it is completely off so I will need to fix this, but overall it's the basis where you can start adding roads and buildings, then adjust the terrain to fit in.
Hopefully, this has helped you, just remember that the most popular spots will have extremely accurate geodata, unlike the UK where geodata satellites don't pass over often.
Most Recent Articles
There are no articles yet.
Battalion 1944 is shaping up to "recapture the core of classic multiplayer shooters and reviving 'old school' FPS". With the game just released as...
If you have wanted to create levels with accurate geometric satellite data, then look no further.
The Portal series is a fantastic puzzler, it's even more rewarding and a great laugh when you play in COOP mode. But what happens when you mix...
When the HTC Vive arrived on the scene, it was notorious for its front-heavy nature due to a lack of weight distribution throughout the...
After a long time thinking about the upgrade, while the forums have little plugins, it was the best time to upgrade to the latest version and think...
With such egregious business practises happening recently and affected multiple games, especially throughout 2017, Aaron Varshney, Kevin...