Topic: Elevation sources, terrain smoothness

Hi Alex, hope you are doing well. I have some questions again.

I want to use elevation for the drone gameplay in my game to look more realistic. I have been using Bing maps elevation and Horizon 2_Bing Maps, that works pretty well, but it is using a lot of API requests, thousands of them, so much that the 125.000 free requests/year will not last very long for one user, let alone several, even with caching. And having a lot of users roaming around the world would get very expensive if I paid for every request.

I know there is a way to intercept it with offline elevation data. Is there some free source for elevation data that could be downloaded and pre-loaded into the game? Lets say that a user lives in a specific area, he could then download the elevation data for only that area.

If not, do you think that Mapbox is a better alternative? I have tried using it but I'm having issues with smoothness of the terrain affecting the movement of the markers. Since the drone also is a marker it moves up and down depending on the terrain elevation, which is fine if it happens smoothly like with Bing elevation:

But with Mapbox it is not smooth at all:

Re: Elevation sources, terrain smoothness


Your app looks amazing, congratulations.

Yes, there are free downloadable sources of elevation data.
For example SRTM and SRTM30.
You can use them in Online Maps via API.
But to be honest, they are not really convenient to use because they are a zipped text file.
Before using them, I would download them all, encode them into a more convenient format that can provide single-pass data loading, and upload them to your own server.
Depending on the format, you could additionally save a lot of space on your server and reduce the amount of downloaded data.

Additionally, using SRTM or SRTM30 will have an unobvious advantage:
They contain large areas (5 degrees and 1 degree respectively).
The data will not be updated frequently, which will solve your mapbox problem.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

3 (edited by CELL9 2023-03-20 23:43:44)

Re: Elevation sources, terrain smoothness

Thank you! I'm quite surprised with the progress I've made considering it's my first ever project.

Downloading the files seems like a good option, I found SRTM data on and but they are in GeoTIFF, HGT, BIL, or DTED formats. I guess they need to be converted to use with online maps? What format would you suggest?

On opentopography I can download an Arc ASCII Grid by setting bounding coordinates, maybe this can be used? … ikeyot2022

ncols        14
nrows        14
xllcorner    18.010972222248
yllcorner    59.379305555555
cellsize     0.000277777778
NODATA_value -32768
 36 36 35 35 36 38 41 44 47 47 48 47 45 42
 34 34 33 33 33 36 40 44 48 48 49 48 46 43
 31 31 31 32 33 36 39 42 46 46 47 46 44 41
 26 27 29 31 34 37 40 41 43 44 45 44 43 40
 24 27 30 33 36 38 40 41 42 42 42 42 41 39
 24 27 31 34 37 38 39 40 41 41 41 40 39 37
 21 24 28 31 35 37 39 39 40 39 38 37 35 33
 18 21 24 28 32 35 38 38 39 38 36 35 33 31
 15 18 21 25 29 33 37 37 38 37 35 33 30 27
 13 15 17 21 25 29 34 35 36 34 31 29 26 24
 11 12 13 16 19 23 27 28 30 29 28 26 24 22
 9 9 10 12 14 17 20 21 23 23 22 21 20 20
 11 11 11 11 12 12 13 13 14 14 15 15 16 16
 12 12 11 11 10 10 10 10 10 10 11 12 13 13 

Although, looking at the public API on opentopodata, it gives the result directly from a specific coordinate. Could that be used?

curl … ,11.976404

  "results": [
      "elevation": 55.0, 
      "location": {
        "lat": 57.688709, 
        "lng": 11.976404
      "dataset": "srtm30m"
  "status": "OK"

I'm also a bit curious what controls the elevation of the markers, I thought it would follow the ground mesh, but that doesn't seem to be the case looking at the Mapbox scenario, as the markers move over and under the ground in steps. But you are saying this problem will not happen with SRTM?

Also, can the elevation control be disabled for a specific marker, so that it always stays at 0 y?

Re: Elevation sources, terrain smoothness

Real World Terrain downloads data as zipped ASCII:

It is your choice whether to convert it or not, because you will have to make your own loader for this data.

Unfortunately, I can't recommend you any format into which this can be converted.
Theoretically, for Tiny Terrain asset I made a pretty good heightmaps compression algorithm that compresses the data much better than zip or even 7zip, and it has a very fast single-pass decompression.
But, right now it only works with Unity Terrain heightmaps.
In the future, when I will have free time, I was thinking to make modification of this algorithm to work with real world data (SRTM, etc.), and share it on GitHub.
If you want to try to modify it yourself, feel free to contact me via email or discord and I'll share it for you.

The APIs that return elevation for point or line are useless in this case.

Yes, I think this effect will either be completely gone or greatly reduced.

You can control this for 3D markers. … 1b4998fa1e

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

5 (edited by CELL9 2023-03-21 16:22:15)

Re: Elevation sources, terrain smoothness

Ok, I think that I have an idea how to do this. Correct me if I'm wrong.

With the opentopography API we can pre-download an ASCII (AAIGrid) file for a specific area when necessary, lets say 100 km^2 around the player. It's downloaded directly and not zipped, size is around 500-600kb and it takes like 10 seconds to generate, so it shouldn't be done too frequently.

The InterceptElevationRequest script requests elevation data within a bounding box.
From the pre-downloaded AAIGrid we can use the provided xllcorner, yllcorner and cellsize to calculate which elements in the grid corresponds to the coordinates of each corner of the requested area.
Then we make a 32x32 array with the elevation values inside that new box and send it to the elevation manager.

Re: Elevation sources, terrain smoothness

You are absolutely right.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.