Importing HeightMaps in OpenTTD?

OpenTTD is a fully open-sourced reimplementation of TTD, written in C++, boasting improved gameplay and many new features.

Moderator: OpenTTD Developers

Nanaki13
Traffic Manager
Traffic Manager
Posts: 151
Joined: 08 Jan 2005 16:08

Post by Nanaki13 »

anybody know where i can get some decent heightmaps of japan?
Maxensen
Engineer
Engineer
Posts: 11
Joined: 21 May 2005 22:22

Post by Maxensen »

Just postet a scenario of Japan made from a height map on the topic "World Scenario" ... they are both made from the maps on:
http://www.ngdc.noaa.gov/mgg/topo/globegal.html
batman
Engineer
Engineer
Posts: 14
Joined: 20 Jul 2004 12:41
Location: Lahti, Finland

Post by batman »

what i have to do to get it work?
i get this error message
i have saved the file as a map.png
Attachments
error.png
error.png (1.34 KiB) Viewed 9198 times
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

@Born_Acorn: Your palette's in the wrong order. Unfortunately, I don't have any good ideas on how to fix that.

@batman, you need an indexed PNG (not true-color) that is the same size as the map you are creating. The GIMP can make indexed PNGs.

Idea: generate a palette entry -> height table, so the palette order is not important? This should be do-able, since [0][0] is required to be height 0, and all other heights are higher. (Image->Mode->Indexed, I believe)

things_to_do.enqueue(palette_to_height_table_for_PNG);
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
User avatar
LKRaider
Transport Coordinator
Transport Coordinator
Posts: 360
Joined: 23 Mar 2005 04:05
Location: Brasil
Contact:

Post by LKRaider »

Would be cool if it could manage anything we throw at it, like for example a true color PNG with more than the allowed height levels.

It should interpolate the Min -> Mid -> Max height levels of the true color PNG and create a map with corrected values. Very noob friendly, heh.
Or is this beyond the point of the tool?
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

Yes, it should be able to take anything. I think the plan for 24-bit color is to convert to greyscale first, and then map brightness->height.

OK, so I can imagine some particularly perverse PNGs (4-bit color with 9 different values in a square of 3x3 pixels, for example (even better: the center pixel is the same color as [0][0])) that may never be valid, but that would probably qualify as a pathological case.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
Maxensen
Engineer
Engineer
Posts: 11
Joined: 21 May 2005 22:22

Post by Maxensen »

Tips for creating a map using GIMP:
1. If the image is colored, use: Tools->Color Tools->Levels and adjust the tree colors. Geographic heightmaps are normaly from low->blue->green->red->high, so reduce the blue a lot, green a little and red a bit. In step 3 only the brightness of a pixel will count.
2. Resize the image to the openttd size: Often it looks better when using NO interpolation.
3. Convert the image to greyscale, and then to Indexed-16-colors (Image->Mode->Generate Optimum Palette, max colors: 16) so the colors are in the right order.
... hope to see some cool scenarios soon =)
User avatar
LKRaider
Transport Coordinator
Transport Coordinator
Posts: 360
Joined: 23 Mar 2005 04:05
Location: Brasil
Contact:

Post by LKRaider »

I'm adding this patch to the Integrated Nightly so more people can try it out :)
cccp
Engineer
Engineer
Posts: 12
Joined: 14 Aug 2001 23:26

Post by cccp »

Here's a patch for rescaling maps of any size, keeping the aspect ratio (method 3 that I described earlier). It uses nearest neighbor resizing, which seems fine for scaling down, but results in a "pixelated" map if you scale something by a factor of 2 or more. I suppose better rescaling/filtering could be added later, but I think this is fine for now.

The code could probably be cleaned up a little too.
Attachments
pngmap6.patch
map resizing patch - images of any size can be used now
(11.21 KiB) Downloaded 372 times
User avatar
Bob Smith
Engineer
Engineer
Posts: 111
Joined: 17 May 2005 23:25

Post by Bob Smith »

Does anyone know where I could find some real heightmaps? I know they're lurking around somewhere but google isn't my friend today.
User avatar
LKRaider
Transport Coordinator
Transport Coordinator
Posts: 360
Joined: 23 Mar 2005 04:05
Location: Brasil
Contact:

Post by LKRaider »

For US data you just need to get the freely avaiable DEM's from the USGS

http://data.geocomm.com/dem/

You may need to convert some of the data to grayscale and so on. For other countries, I am not sure where to find this kind of data.


Also, if anyone would like to implement an SDTS to OTTD import:
http://mcmcweb.er.usgs.gov/sdts/source.html
:wink:
User avatar
lucaspiller
Tycoon
Tycoon
Posts: 1228
Joined: 18 Apr 2004 20:27

Post by lucaspiller »

Google Maps has some satellite images that work quite well, yep they aren't proper heightmaps, but they do provide fairly good results.
No longer active here, but you can still reach me via email: luca[at]stackednotion[dot]com
fistersn
Engineer
Engineer
Posts: 23
Joined: 31 Dec 2003 10:43

Post by fistersn »

This HeightMap patch that you are talking about.. Is that a script or a program? And if I what to try it out, how do I do that? Must I compile the patch with the opendttd source?
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

Guess I need to pull another compile run.

The patch is in cccp's last post.

I heard a report that unrar doesn't always work in Linux, so I've started posting source 7z archives instead.
Attachments
trunk.7z
(1.88 MiB) Downloaded 321 times
PNGLoadv6.zip
(431.58 KiB) Downloaded 449 times
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
User avatar
Smudge
Engineer
Engineer
Posts: 95
Joined: 31 Jan 2005 12:55
Location: Oostende, Belgium
Contact:

Post by Smudge »

-How comes I can't edit the created scenario's of Heightmap in the OTTD scenario editor.

- How do I apply these patches
User avatar
jvassie
Tycoon
Tycoon
Posts: 3421
Joined: 18 Dec 2002 18:00
Location: High Wycombe, England
Contact:

Post by jvassie »

Sorry if ive been ignorant, but could someone please explain exactly how they get this to work, from downloading the patch to playing on a map in Openttd.

Cheers
James
(British) Modular Stations Set - Thread: | Website:
Swiss Set - Thread: | Website:
Route Map Creator
My Screenshot Thread
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

Smudge wrote:-How comes I can't edit the created scenario's of Heightmap in the OTTD scenario editor.
Works for me

James:
If you want to compile it yourself, download either pngmap6.patch or trunk.7z (already patched). Apply the patch, if you downloaded it, and then compile.
If you don't want to compile, or can't, download PNGLoadv6.zip, and extract the executable and lng file to the appropriate places.

Create an indexed PNG with no more than 16 colors, call it map.png, and place it in your OTTD directory. Then start OTTD and click the "Load Land" button in the scenario editor. Proceed as normal for creating a scenario.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
User avatar
Purno
Tycoon
Tycoon
Posts: 16659
Joined: 30 Mar 2004 12:30
Location: Almere, The Netherlands

Post by Purno »

OTTD asks for a 4-bit map, but I can only make 8-bit maps. Irfanview can make 4-bit map but the map is totally wrong. How do I create a proper 4-bit map?
Attachments
What OpenTTD makes...
What OpenTTD makes...
screenshot.png (46.92 KiB) Viewed 2530 times
The 4-bit conversion by IrfanView
The 4-bit conversion by IrfanView
map.PNG (13.86 KiB) Viewed 8522 times
The original map (with high quality)
The original map (with high quality)
Kopie van map.PNG (18.67 KiB) Viewed 8523 times
Contributor to the The 2cc Set and Dutch Trainset. Inventor of the Metro concept. Retired Graphics Artist.
Image Image
Download TT | Latest TTDPatch | OpenTTD | OpenTTDCoop | BaNaNaS: OpenTTD content system | 2048² OTTD scenario of the Netherlands
GRF Codec | GRF Crawler | GRF Maker | Usefull graphics & tools sites | NML Documentation Wiki | NFO Documentation Wiki
All my graphics are licensed under GPL. "Always remember you're unique, just like everyone else."
FoxAlpha
Engineer
Engineer
Posts: 85
Joined: 06 May 2005 18:19
Location: Germany
Contact:

Post by FoxAlpha »

The problem with ur Highmap is the palette order.
The colors are not in the order u have paint there, because of conversation i thing.

Reopen it and change the colors to one in the order u want to have on the map.

Foxy

Edit: I have edited ur Map and i thing this is what u want to have
Attachments
perhaps not the exact thing u want but near by i think
perhaps not the exact thing u want but near by i think
map.png (13.69 KiB) Viewed 8484 times
Last edited by FoxAlpha on 16 Jul 2005 15:43, edited 1 time in total.
User avatar
Purno
Tycoon
Tycoon
Posts: 16659
Joined: 30 Mar 2004 12:30
Location: Almere, The Netherlands

Post by Purno »

FoxAlpha wrote:The problem with ur Highmap is the palette order.
The colors are not in the order u have paint there, because of conversation i thing.
I know
Reopen it and change the colors to one in the order u want to have on the map.
How?
Foxy
Thx
Contributor to the The 2cc Set and Dutch Trainset. Inventor of the Metro concept. Retired Graphics Artist.
Image Image
Download TT | Latest TTDPatch | OpenTTD | OpenTTDCoop | BaNaNaS: OpenTTD content system | 2048² OTTD scenario of the Netherlands
GRF Codec | GRF Crawler | GRF Maker | Usefull graphics & tools sites | NML Documentation Wiki | NFO Documentation Wiki
All my graphics are licensed under GPL. "Always remember you're unique, just like everyone else."
Post Reply

Return to “General OpenTTD”

Who is online

Users browsing this forum: No registered users and 0 guests