Page 1 of 2

Load image in Kroms

PostPosted: 13 Apr 2009, 18:06
by Ben
Okay, in Kroms map editor, you can use 'load image' under relief to elavate the map. It doesn't work to well for me. Does anyone have any ideas on how to use this?

Thanks.

PostPosted: 13 Apr 2009, 18:16
by Krom
LOL, it does work well for me, does anyone knows what am I doing wrong?

PostPosted: 13 Apr 2009, 18:21
by harold
Works for me..
But it does work a bit strangely, when I dumped all height data from a map into a picture and loaded it as heightmap, the height ended up being different
Not what I expected...

PostPosted: 13 Apr 2009, 18:39
by Krom
Since I never planned support for height dumpers .... perhaps you messed ushort with 0..100 KaM range byte...

PostPosted: 13 Apr 2009, 18:53
by harold
I just ripped them from a map and put them into a bitmap like so:

byte height = readbyte();
pixture.setPixel(x,y,new Color(height,height,height));

for every pixel

PostPosted: 13 Apr 2009, 19:21
by Krom
Shame on you if you can use dumper, but can't figure out how to recreate height data :wink:

PostPosted: 13 Apr 2009, 19:22
by harold
Yea I guess but how do I do it then? What value does the heightmap reader use?

PostPosted: 13 Apr 2009, 19:30
by Krom
Ghm... should I suggest you to try 0..255 gradient? Thats easiest way to fugure it out :wink:

PostPosted: 13 Apr 2009, 23:43
by Ben
I still don't get it. Could someone show me a picture so I can see what you are talking about?

PostPosted: 13 Apr 2009, 23:55
by harold
Converted to PNG for web - convert back to BMP for Kroms editor
Image

Idea for Krom: also support PNG please? Or do you read the picture manually?

PostPosted: 14 Apr 2009, 04:34
by Krom
Idea is that lighter color means higher elevation, and each pixel represents one tile of terrain. Bitmap should match map size, but that's not mandatory, you still can experiment with smaller/bigger bitmaps. To be honest I didn't tried to recreate elevation patterns in Photoshop and apply them to terrain, otherwise I would have written a tutorial. Still thats a feature and with some skill it can be used to advantage.

@Harold: I use Grpahics.TBitmap.LoadFromFile, it reads most of BMP formats well. I could add Jpeg, but that would be stupid, cos it's a lossy format and we have pixel data here. PNG - I don't have png loader for Delphi, but even if I had - there's not much gain in using it for 144x144x8 pics.

PostPosted: 14 Apr 2009, 11:51
by harold
Ok anyway, what's the deal here, you divide the height from the bitmap by 2.5 or something? Why? You just lose precision and range that way..

PostPosted: 14 Apr 2009, 12:03
by Krom
Maybe because KaM uses 0..100 range for height and I like to keep it that way :wink:
Do you want me to clip it to 0..100 or what?

PostPosted: 14 Apr 2009, 12:08
by harold
Lol no that would be worse :lol:
edit: no forget that, I thought about it again and I think clamping it to 0..100 would make it easier
So ok. I guess the exact multiplier is 2.55, correct?
Oh and there is a feature that would be much nicer than PNG support.. Loading the height map at a different tile than left top. Mainly for mountains which are hard to draw by hand..

PostPosted: 08 Oct 2009, 03:00
by Ben
You mean I actually have to DRAW that? Ouch well never mind then won't be using load image :lol: