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

User avatar
yasinko
Engineer
Engineer
Posts: 23
Joined: 02 Jun 2005 23:37
Location: Istanbul, Turkey
Contact:

Post by yasinko »

I have used sv0creator to import a heightmap. I used a program called GEODAS to get a heightmap, and then converted to a bitmap (common BMP file) using printscreen key. Opened in MSPaint and fine-tuned with ACDsee and then imported via sv0creator. The Countour seems OK (as you may see below), but something is dissatisfying, because although the sea-line countour is fine, there is only a plateau behind the coast, and elevations don't change ver much. Well, in fact it must have been changing dramatically.
I am using WinXP(isnt it obvious at all?), and only sv0creator itself without ant patch because don't seem to understand where to apply them...

Is it because the red color in the heightmap? Should I use blue-green shades only?

Or is it the game limit since sharp (steep) mountains cannot be fully represented in TT?

PS: Dont understand terms pallette order, 4-bit bitmap (I assume windows bitmap I contribute is 16bit, I might have been wrong, probably, with a high probability, exactly, uh-whatever)
Attachments
this is a part of the terrain, which is unrealistic.
this is a part of the terrain, which is unrealistic.
terrain.PNG (84.06 KiB) Viewed 7240 times
contour is fine, but...
contour is fine, but...
countour.PNG (34.13 KiB) Viewed 1335 times
untitledTRneg.PNG
grey heightmap
(16.24 KiB) Downloaded 3826 times
______________
yasinko
______________
Archonix
Chief Executive
Chief Executive
Posts: 733
Joined: 01 May 2003 17:29
Location: Manchester, UK
Contact:

Post by Archonix »

Your problem there is that the land is too bright. The brightness of the land is how high it is. If you want the land next to the sea to be low it needs to be a lot darker.
Brignell’s law of consensus: At times of high scientific controversy, the consensus is always wrong.
Nappe1
Traffic Manager
Traffic Manager
Posts: 175
Joined: 19 Jan 2004 17:25
Location: kotka or Savitaipale, Finland
Contact:

Post by Nappe1 »

yasinko wrote: PS: Dont understand terms pallette order, 4-bit bitmap (I assume windows bitmap I contribute is 16bit, I might have been wrong, probably, with a high probability, exactly, uh-whatever)

This is the main problem. you need to reduce the color depth to 16 colors before saving it. (first convert the height map to Greyscale and then save it as 16 colors PNG file.)

Also, if you want to make highest point of your height map as high as it is possible in OTTD map, you need to adjust color levels after you have converted the height map to greyscale.
FoxAlpha
Engineer
Engineer
Posts: 85
Joined: 06 May 2005 18:19
Location: Germany
Contact:

Post by FoxAlpha »

Can someone please update this patch ?

I try to apply this to the current SVN, but landscape.c has too many changes and my Compiler wont finish.

Fox
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

OK, up to date. No functional changes.

Not sure how useful 6to7.diff will be, but I'll post it anyway.
Attachments
pngmap6to7.diff
(3.11 KiB) Downloaded 221 times
pngmap7.patch
(11.01 KiB) Downloaded 237 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
FoxAlpha
Engineer
Engineer
Posts: 85
Joined: 06 May 2005 18:19
Location: Germany
Contact:

Post by FoxAlpha »

Thx for ur Work.

No Errors. Now it is possible to include it in my Integrated Build (See Signature)

Fox
User avatar
lucaspiller
Tycoon
Tycoon
Posts: 1228
Joined: 18 Apr 2004 20:27

Post by lucaspiller »

Here is a new version, now with a file selector dialog, so you can select what file to load. It is untested on Windows and OS2, so if it doesn't compile fix it yourself.
Attachments
pngmap8.patch
(25.72 KiB) Downloaded 253 times
No longer active here, but you can still reach me via email: luca[at]stackednotion[dot]com
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

PNGmap9 is a minor codechange (see pngmap8to9.diff (next post)) and an update to r2963.

Since I have to double-post anyway, there's some duplicate data in these two posts. This post has the full source of PNGmap9 (rar and 7z), and pngmap9.patch.
Attachments
pngmap9.patch
(25.94 KiB) Downloaded 225 times
source.7z
(1.92 MiB) Downloaded 206 times
source.rar
(1.89 MiB) Downloaded 201 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
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

This post contains pngmap8to9.diff, and a win32 binary (zip)
As its revhack reflects, this binary is expected to be compatible with the current nightly (r2963).
Attachments
OTTD-r2963-PNGmap9.zip
(662.18 KiB) Downloaded 343 times
pngmap8to9.diff
(674 Bytes) Downloaded 203 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
richk67
Tycoon
Tycoon
Posts: 2363
Joined: 05 Jun 2003 16:21
Location: Up North
Contact:

Post by richk67 »

Awesome patch Dalestan...

I want to create some maps that work with 0.4.0.1. However cygwin (only compiler I have) cant build with the PNG libraries.

Can you create & post a win32 binary of 0.4.0.1 + pngmap9.patch only?

Will scenarios created with this be compatible with all 0.4.0.1+ nightlies?

Thanks
RichK
OTTD NewGRF_ports. Add an airport design via newgrf.Superceded by Yexo's NewGrf Airports 2
Want to organise your trains? Try Routemarkers.
--- ==== --- === --- === ---
Firework Photography
MeusH
Tycoon
Tycoon
Posts: 4349
Joined: 25 Oct 2004 15:39
Location: Mississauga

Post by MeusH »

Sorry for posting in a few-months old thread. However, I'm experiencing very irritating bugs.

I've made a 4-colour png ready to be imported to OTTD, so I'm importing it and I see all valleys became mountains and vice-versa.
So I've inverted all colours in the image, saved in 4 colour mode (so OTTD can read it) and imported. And what I saw? All valleys remained mountains and vice-versa. The land was a bit higher, however. Just don't look at the diffusion - I've turned it off now.

I've compiled Heightmap v9 on r2963 without errors and warnings.
Why is the result almost the same with different heightmaps?


Edit:
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
I think my problem is the same. Can you tell me what software were you using to fix Purno's heightmap?
I'm using Adobe Photoshop 7.0
Attachments
WHITE.png
WHITE.png (30.02 KiB) Viewed 6337 times
BLACK.png
BLACK.png (30.18 KiB) Viewed 6336 times
User avatar
Bob Smith
Engineer
Engineer
Posts: 111
Joined: 17 May 2005 23:25

Post by Bob Smith »

I used Paint Shop Pro and created custom palettes to get heightmaps to import how I wanted.
MeusH
Tycoon
Tycoon
Posts: 4349
Joined: 25 Oct 2004 15:39
Location: Mississauga

Post by MeusH »

I'm wondering if Paint Shop Pro X 30 days Trial would do the right job...
I'm also wondering if my Photoshop can load your palette file... Can you attach it, please?
richk67
Tycoon
Tycoon
Posts: 2363
Joined: 05 Jun 2003 16:21
Location: Up North
Contact:

Post by richk67 »

MeusH - one thing I noticed. You say 4-colour PNG. Its actually 4-bit colour; ie. 16 colours. You can get a whole load more detail in your maps this way.

PS. I use PaintShopPro 7 to do just the conversion to the right bit-depth and sort out palette problems. One useful trick once you have it nearly correct, is to convert to greyscale, then jump back to 4-bit. The palette is then in 16 strict shades of grey - perfect for import.
OTTD NewGRF_ports. Add an airport design via newgrf.Superceded by Yexo's NewGrf Airports 2
Want to organise your trains? Try Routemarkers.
--- ==== --- === --- === ---
Firework Photography
MeusH
Tycoon
Tycoon
Posts: 4349
Joined: 25 Oct 2004 15:39
Location: Mississauga

Post by MeusH »

Okay, thank you, I'll try to work on it more in Photoshop, if without success, I'll download PaintShop trial...
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

richk67 wrote:Can you create & post a win32 binary of 0.4.0.1 + pngmap9.patch only?
I can post a patch that compiles, but it won't link; it appears that 0.4.0.1 expects zlib to contain stuff it doesn't. (compiling with MSVC .NET; compiling 3244 works.)
richk67 wrote:Will scenarios created with this be compatible with all 0.4.0.1+ nightlies?
Yes, if it can be made to link.

Here's the patch, if anyone wants to play with it. (0.4.0.1 is/was rev 2354, I believe. That's the revision I made this patch against, anyway.)
Attachments
pngmap0.4.0.1.patch
(26.04 KiB) Downloaded 196 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
MeusH
Tycoon
Tycoon
Posts: 4349
Joined: 25 Oct 2004 15:39
Location: Mississauga

Post by MeusH »

DaleStan: could you tell me what graphics software do you use to create heightmaps, please?
User avatar
Ladis
Engineer
Engineer
Posts: 60
Joined: 04 Dec 2004 15:15
Location: Prague

Post by Ladis »

Meush, your map was in 256 colours mode, and that heigh-map importer need it in 16 colours (as 15 levels of land and 1 as sea). So I converted it and here it is. I made a scenario and everything is what it was supposed to be. Just an important note: each level of land is created out of special colour from the scale, so you cannot expect a 1st level land to be created out of black (sea) sprayed by some grey - that makes just small islands. If you want to create a map, you need to use all those colours putting them at each other. Then, you can spray for example 8th level land colour with 2nd level land colour, but not very densely - that will make very nice and naturally looking mountains.
Attachments
your map in 16 colours
your map in 16 colours
map.jpg (75.87 KiB) Viewed 6128 times
MeusH
Tycoon
Tycoon
Posts: 4349
Joined: 25 Oct 2004 15:39
Location: Mississauga

Post by MeusH »

Thank you! Could you tell me what what software were you using? I'll modify the png anyway because I knew there will be loads of islands/pyramides
railer
Engineer
Engineer
Posts: 24
Joined: 07 Jun 2005 12:22

Post by railer »

This PNG-import is such useful I don't understand why it's still not in the trunk.. :roll:
And what to do with maps that are not islands, like yours MeusH, because it's a must to have water on each side.. I think it would be more realistic not not have water and water and water and water :twisted: :twisted:
Post Reply

Return to “General OpenTTD”

Who is online

Users browsing this forum: No registered users and 27 guests