Guide: Using Heightmaps
|
SportingNonsense |
Posted on 25-08-2015 23:59
|
Team Manager
Posts: 33046
Joined: 08-03-2007
PCM$: 200.00
|
The best way to create stages is always from elevation data using GPX files, but the coverage of the .DEM files is limited.
So how to create stages from other parts of the world?
You can create a stage from 'Nothing' and have to create the entire profile from scratch, but this can be a lot of work. The other option is to create using a heightmap, but nobody has ever really understood how they work, or tried to explain it if they did.
Last week I decided to search around and figure it out, in order to make the Rio Olympics course. After doing my own experimentations, some discussions with Monod, and a bit of guessing that fortunately worked, I have found a method that works. There are limitations with the heightmap feature - Cyanide haven't made it easy to use - but there are ways around those constraints.
So, here is a guide.
Step 1 - The Heightmap
There are a couple of ways to download a heightmap. The easiest, and my preferred method, is using the website https://terrain.party/
This website gives you a shaded blue square which you can drag anywhere in the world. The size of the square can be changed, but it is important that the size you use is 30km.
Download your chosen area using the button above the size selection. This will give you a zip file containing 4 png files: (ASTER 30m), (Merged), (SRTM3 v4.1), (SRTM30 Plus). The readme file in the download recommends that the Merged image is the best one to use.
Open the .png in Paint.net (or similar software), and save it as .tga.
You can now load this .tga into the stage editor, through the new file prompt.
You might find that it loads upside down. If so you will need to go back to Paint.net, rotate the image 180 degrees, save it and reload it.
Step 2 - A wider map
If you are doing some form of circuit race, this first step might be enough, but a lot of races take place in an area wider than 30km x 30km. The reason for the limit per heightmap file of 30km is down to the stage editor. Whatever size heightmap you load into the stage editor it will resize it into a 30km x 30km size. So only by loading a 30km x 30km map can you keep the distances correct.
But there is a solution to this. First, download any additional heightmaps from terrain.party. Do your best to make sure the maps are next to each other, but do not overlap.
Load each heightmap into it's own stage editor file and on each one draw a series of roads.
First: A road from the bottom right hand corner to the bottom left hand corner
Second: A road from the top left hand corner, which joins the first road at the bottom left hand corner
Third: A road from the top right hand corner, which joins the second road at the top left hand corner
Add route checkpoints, starting from one end and ending at the other.
Then select all 4 road points (hold down CTRL when selecting, to select all at once).
Select File -> Export Selected Road Network. Leave both boxes ticked, click ok, then save the export.
Now create a new file from 'Nothing'. The terrain size you choose will need to be able to fit your maps. For the Rio course I needed two 30km maps side by side, so the minimum terrain size I had to have was 60000.
Go to File -> Import Road Network. Choose your first road network, and line it up into one of the corners of the map, using the small white road point circles as a guide. Press Import, with all options ticked.
Save your zcts. Close the stage editor, then re-open the editor and the zcts.
As you can see, the terrain has now all been loaded.
Now load the next map. Line it up as close as possible to the first one. Keep on going until your 'jigsaw puzzle' map is complete.
Step 3 - Draw the roads
Now you need to draw the road network.
While you cannot use a GPX file in the editor to guide you, you will still need to have a GPX file of your route - or some form of map - and have that open on your GPX website of choice e.g. Bikeroutetoaster, Mapmyride. For the Rio course, I used the Strava recording from Romain Bardet from the recent test event. I recommend viewing the map using a terrain mode.
You will need to use the terrain features, such as inclines and sealines, to help you place the roads in the correct position.
Here's a simplified example of what my Rio roads looked like.
Step 4 - Adjusting the height
Now we come to the biggest issue with heightmaps. They don't give you the correct height! As with the 30km size limit, this is down to the way Cyanide designed the stage editor.
The proportions are correct, they just don't go high enough. See below a comparison between the editor and Strava (editor has 4 laps of each circuit, Strava has 2 laps). Rather than the highest point of the race being 460m, it is only 150m in the editor.
So you are going to need to raise the terrain!
First, make sure the 'Snap objects to landscape' option is unticked. When raising the height of a road point, there are two methods.
1. In the 3D tab, drag upwards on the blue upwards arrow.
2. In the Profile View tab, enter your desired new altitude and click enter.
This will not affect the surrounding terrain however, so you will need to use the terrain tools to raise that land in order to make the landscape look right.
My tip would be to first use the 'Terrain Rise' tool to raise an area, followed by the second 'Terrain Smooth' tool afterwards to remove the pointyness of what you have just risen. I prefer to raise the whole area small amounts at the time, rather than doing a small area in one go - but you will have to practise and decide on your own method.
It is also up to you on whether you set the road heights first and then the terrain, or to do them at the same time. It would be ideal if you can set up the road heights first, however I find it easier to sort out the roads on climbs when the terrain is already in place - given that it can sometimes be challenging to put the road points in the correct place, with hairpins and such, in order to avoid road overlaps and bad route slopes.
This will take some experimenting on your part and, particularly if it is a larger climb, don't expect to be able to sort it out quickly. Just remember to regularly save the zcts file as you go along!
At the end of it all, hopefully your profile will now accurately replicate the one shown on your GPX route.
Step 5 - Normal stage making touches
Complete the stage as you would any other. Adding in seas, rivers, cities, forests, isolated objects etc, asjusting road widths, markings and textures, and of course start line, finish line, podium and any sprints.
If you have done a lot of height adjusting, be prepared for a lot of road overlaps and bad route slopes!
Eventually, your stage will be ready to export and be shared on the forum! (Like my Rio RR will be at some point in the next couple of days!!)
---
And that's the guide. Like I said, it's not the easiest way to make a stage! It is easier than making a race completely from a flat 'Nothing' map as it allows you to get the distances right, and at least gives you an outline of the elevation. And until Cyanide give us more. DEM files, that is about as good as it gets!
Feel free to ask any questions or give feedback on the guide - particularly if you use it to make your own stage!
|
|
|
|
samu12 |
Posted on 26-08-2015 00:24
|
Stagiare
Posts: 236
Joined: 11-01-2012
PCM$: 200.00
|
Thanks for this guide! Last time i hadn't got DEM files, y created manually seven islands, and it took a lot of time
|
|
|
|
coolrex |
Posted on 26-08-2015 01:52
|
Protected Rider
Posts: 1168
Joined: 01-01-2015
PCM$: 300.00
|
instead of terrain party i used this NASA site:
https://gdex.cr.usgs.gov/gdex/ |
|
|
|
Episode1 |
Posted on 26-08-2015 08:21
|
Free Agent
Posts: 117
Joined: 09-11-2013
PCM$: 300.00
|
How do you save something as .tga file? I know it already sounds dumb, but need to ask |
|
|
|
trekbmc |
Posted on 26-08-2015 08:23
|
Team Leader
Posts: 7366
Joined: 11-07-2014
PCM$: 700.00
|
Episode1 wrote:
How do you save something as .tga file? I know it already sounds dumb, but need to ask
You need a program like paint.net then you can go save as then tga.
"What done is, is one." - Benji Naesen
|
|
|
|
Episode1 |
Posted on 26-08-2015 08:31
|
Free Agent
Posts: 117
Joined: 09-11-2013
PCM$: 300.00
|
Yeah, there's the problem... I've used paint, but if I save it, there are 5 options, but nowhere tga. I've also saved it as all five of them and also once putting .tga at the back, but stage editor didn't see it... |
|
|
|
trekbmc |
Posted on 26-08-2015 08:38
|
Team Leader
Posts: 7366
Joined: 11-07-2014
PCM$: 700.00
|
paint.net and paint are different things (I've made this mistake before as well ) https://www.getpai...nload.html
"What done is, is one." - Benji Naesen
|
|
|
|
Ad Bot |
Posted on 23-11-2024 22:14
|
Bot Agent
Posts: Countless
Joined: 23.11.09
|
|
IP: None |
|
|
Episode1 |
Posted on 26-08-2015 08:40
|
Free Agent
Posts: 117
Joined: 09-11-2013
PCM$: 300.00
|
-_________- wow. |
|
|
|
SportingNonsense |
Posted on 26-08-2015 10:23
|
Team Manager
Posts: 33046
Joined: 08-03-2007
PCM$: 200.00
|
As far as I can see, there is no easy way to select a 30km x 30km area on that site, so I wouldn't recommend using it. If the map area you download is not that size, you will get incorrect distances in the editor.
|
|
|
|
coolrex |
Posted on 26-08-2015 11:48
|
Protected Rider
Posts: 1168
Joined: 01-01-2015
PCM$: 300.00
|
SportingNonsense wrote:
As far as I can see, there is no easy way to select a 30km x 30km area on that site, so I wouldn't recommend using it. If the map area you download is not that size, you will get incorrect distances in the editor.
yeah ok, but it is more accurate then the other site. |
|
|
|
SportingNonsense |
Posted on 26-08-2015 11:54
|
Team Manager
Posts: 33046
Joined: 08-03-2007
PCM$: 200.00
|
Well no, it's not going to more accurate if the distances are wrong
|
|
|
|
Margh Norway |
Posted on 26-08-2015 17:23
|
Sprinter
Posts: 1507
Joined: 23-07-2010
PCM$: 200.00
|
Great investigative work, thanks for the tutorial!
Will give it a try, at least for a short circuit.
|
|
|
|
mpardo |
Posted on 26-08-2015 21:03
|
Sprinter
Posts: 1738
Joined: 06-09-2011
PCM$: 200.00
|
This is very interesting. It is a shame that the altitudes don't quite reflect the real world but I tried downloading one of the heightmaps and in the readme file they mention that the file was manipulated to overcome some limitation in Cities: Skylines. It could well be the case that a bit of manipulation of the heightmap itself leads to the correct altitudes.
|
|
|
|
manindemaan |
Posted on 31-08-2015 17:35
|
Free Agent
Posts: 141
Joined: 02-08-2009
PCM$: 200.00
|
thanks SN for this awesome tutorial !
mpardo wrote:
This is very interesting. It is a shame that the altitudes don't quite reflect the real world but I tried downloading one of the heightmaps and in the readme file they mention that the file was manipulated to overcome some limitation in Cities: Skylines. It could well be the case that a bit of manipulation of the heightmap itself leads to the correct altitudes.
The problem is in the way the StageEditor reads heightmap files. Those files are in tga format and have values from 0 to 255 for every pixel. Usually, 255 should be 8000m or some arbitrary max value, but in the StageEditor, a pixel value of 255 will be used as 255 meter above sea level. There should be some gain, but it isn't.
If you could change the values in the image that might work, but it is no simple ascii code...
The thing you mentioned is that in city areas the height values are reduced slightly to match the ground level, rather than the level of the top of buildings. When the underlying data is generated by the return time of reflected signals then those signals are reflected by roofs of buildings instead of the ground and therefore return wrong height values. |
|
|
|
mpardo |
Posted on 02-09-2015 10:44
|
Sprinter
Posts: 1738
Joined: 06-09-2011
PCM$: 200.00
|
Yes, I know what you mean. I was thinking along the lines of testing whether we can use a 16 bit palette instead of an 8 bit normal RGB (that might be why the limit is at 255 meters). I am not initiated in image processing, so it would probably take me a long while to do something usable but maybe worth giving it a go.
|
|
|
|
Margh Norway |
Posted on 04-12-2015 13:22
|
Sprinter
Posts: 1507
Joined: 23-07-2010
PCM$: 200.00
|
I used this technique some time ago to see how it works. Tutorial is well-written, I had no issues following the steps. As stated by SN it is less handy to make mountain stages this way (due to the incorrect height problem), but I started a stage on Barbuda (highest point 40m) where using heightmaps seems the convenient way to go.
One thing I just recognized is that there is an okayish way to replace the gpx for route purposes. As the files you get from terrain.party are .png you can virtually draw the route right on the pic. I opened the file with windows paint and used the pencil tool, saved and then converted it into tga-format.
As the drawing creates a notch in the landscape it seems best to draw thin and use a color with less contrast to the dark heightmap image. Otherwise you may need to smooth or flatten the parts where your route is going after you've created the roads.
On a less serious note it opens up many new possibilities to know you can create a stage from any pic you want... e.g. climb Mt. Cartman
|
|
|
|
togo95 |
Posted on 21-12-2015 22:50
|
Domestique
Posts: 442
Joined: 06-01-2011
PCM$: 200.00
|
I was doing the stage 6 of Vuelta Mexico and played a bit with this method. I figured out a way to get the correct elevation scale. However, it only works because the whole stage happens between altitude of 2650 and 2750, i.e. the difference is less than 255. If that is the case you can do the following:
1. Download the elevation file for the area you are interested in from here and install VTBuilder.
2. Get coordinates for some 30km x 30km square. In VTBuilder, import the elevation data (Ctrl+I). Then use the coordinates for Area Tool -> Numeric Values. Save this selection as a new layer using Area Tool -> Sample elevation
(tbh I didn't actually get the coordinates, I just used the terrain.party to guess where I should cut the map and it worked fine).
3. Open this saved layer in a new project. Use Elevation -> Fill in unknown areas. Now if you want to keep elevation info for the altitude between X and X+255, then remove elevation range for the values "0 X" and set unknown areas to X. Similiarly remove elevation range for the values "X+255 10000" and set unknown areas to X+255.
4. Save the elevation data using Elevation -> Export to... (I used bitmap) and convert it to tga.
5. Now you can load it to stage editor like in SN's method. For some reason when I did it, the terrain was a bit terraced (maybe forgot to check "Floating point" instead of "Integer" when sampling elevation or it can be something else). It only took a minute to repair that by smoothing the terrain though. Eventually I raised the bits of the landscape that were cut off (I didn't need to lower anything).
It isn't ideal by any means, but for the case of circuit races it works well. Maybe someone will be able to improve on this even further |
|
|
|
emre99 |
Posted on 03-05-2016 15:35
|
Classics Specialist
Posts: 3332
Joined: 19-07-2012
PCM$: 200.00
|
coolrex wrote:
Actually a great question. you know if you do bigger then 30x30, it becomes 30x30.
does the stage editor converts area's lower then 30x30 also to 30x30? so that you can create for example monaco easier, but bigger in scale?
nice to see you back on the forum
#FREELANDA #FREELIA MISSION ACCOMPLISHED
emre99's stages
Thread of the Week : Tour of California 2014
-Official PCM World Cup 2016, 10th best keirin player in the world
PCM.daily Awards : 2 Nominee 0 Award
Daily Song Contest WINNER! With Foals - Mountain at my Gates with Greece!
1 like 1 girlfriend
''I call you the stage god. You are the stage god.'' -baseballover312, 15.07.2016
|
|
|
|
Leon40 |
Posted on 03-05-2016 19:41
|
Neo-Pro
Posts: 276
Joined: 01-07-2008
PCM$: 200.00
|
Monaco ?
[url=https://legruppetto.com/forum/viewtopic.php?f=70&t=2912] My topic on
[/url]
|
|
|
|
coolrex |
Posted on 03-05-2016 19:51
|
Protected Rider
Posts: 1168
Joined: 01-01-2015
PCM$: 300.00
|
Well ok that's nice, but what i ment to say is, that if its get bigger, you can make the city more realistic and maybe create the Monaco Grand Prix much easier.
or is it possible with just your cities that you (just?) made? |
|
|