Map Database  •  FAQ  •  RSS  •  Login

Load image in Kroms

<<

Krom

User avatar

Knights Province Developer

Posts: 3282

Joined: 09 May 2006, 22:00

KaM Skill Level: Fair

Location: Russia

Post 08 Oct 2009, 07:21

Why not :wink:
You can load a height map from Google search and use it. Also it could be used to make image-maps, you know, color section into green-yellow-brown-blue to make a sort of picture as well with height :wink:
Knights Province at: http://www.knightsprovince.com
KaM Remake at: http://www.kamremake.com
Original MBWR/WR2/AFC/FVR tools at: http://krom.reveur.de
<<

Thunderwolf

User avatar

Crossbowman

Posts: 233

Joined: 22 Jan 2008, 23:00

Website: http://thunderwolf.freehost10.com/KaMMissionBuilder/index.php

Location: Netherlands

Post 08 Oct 2009, 07:41

Never used the load image thing... and by the looks of it, probably never will.
~old sig
MissionBuilder v0.9f2 UPDATED!!
Defend The Outer Colony. fight for your king and uncover the secrets of this land.
Temporary version at
http://thunderwolf.x10hosting.com/index.php
"You can't defeat me, I've played Knights and Merchants"
<<

Ben

User avatar

Former Site Admin

Posts: 3814

Joined: 08 Jan 2009, 23:00

Location: California - Pacific Time (UTC -8/-7 Summer Time)

Post 08 Oct 2009, 21:53

Yeah I'm not saying that it isn't usful, but just that I don't think I will ever be in situation where it will be effective.
I used to spam this forum so much...
<<

Thunderwolf

User avatar

Crossbowman

Posts: 233

Joined: 22 Jan 2008, 23:00

Website: http://thunderwolf.freehost10.com/KaMMissionBuilder/index.php

Location: Netherlands

Post 08 Dec 2009, 21:18

Hey,

sorry for necroposting in this topic, but can anyone tell me what I'm doing wrong here?

Height directly into color (0-100)
Image

Height*2.55 (0-255 (8bit) radius)
Image

P.S. I'm using m1 (TSK version)
~old sig
MissionBuilder v0.9f2 UPDATED!!
Defend The Outer Colony. fight for your king and uncover the secrets of this land.
Temporary version at
http://thunderwolf.x10hosting.com/index.php
"You can't defeat me, I've played Knights and Merchants"
<<

Krom

User avatar

Knights Province Developer

Posts: 3282

Joined: 09 May 2006, 22:00

KaM Skill Level: Fair

Location: Russia

Post 09 Dec 2009, 06:29

You are doing everything right, but whats the problem?
Knights Province at: http://www.knightsprovince.com
KaM Remake at: http://www.kamremake.com
Original MBWR/WR2/AFC/FVR tools at: http://krom.reveur.de
<<

Thunderwolf

User avatar

Crossbowman

Posts: 233

Joined: 22 Jan 2008, 23:00

Website: http://thunderwolf.freehost10.com/KaMMissionBuilder/index.php

Location: Netherlands

Post 09 Dec 2009, 08:43

The problem is that when I use that load image thingy, it doesn't look like the original (well, it almost looks like the original, but not completely).

Loaded your map editor twice with tsk m1 loaded, then loaded the heightmap in one of them, it looked 'different'...

b.t.w. Does your editor also do something with DirectX? when the overwritten ddraw.dll is in the knights and merchants folder, the map editor doesn't show up... when renaming or removing the file again it works...
~old sig
MissionBuilder v0.9f2 UPDATED!!
Defend The Outer Colony. fight for your king and uncover the secrets of this land.
Temporary version at
http://thunderwolf.x10hosting.com/index.php
"You can't defeat me, I've played Knights and Merchants"
<<

Krom

User avatar

Knights Province Developer

Posts: 3282

Joined: 09 May 2006, 22:00

KaM Skill Level: Fair

Location: Russia

Post 09 Dec 2009, 12:54

Maybe the way you've got the "original" image changed it somehow? I don't remember my code by line, but it's pretty straightforward - replace maps height with data from image. Anyway the thing is to let you create relief in Photoshop and then import it, nothing more. Although it's interesting what else could be done with this function :)
Knights Province at: http://www.knightsprovince.com
KaM Remake at: http://www.kamremake.com
Original MBWR/WR2/AFC/FVR tools at: http://krom.reveur.de
<<

Thunderwolf

User avatar

Crossbowman

Posts: 233

Joined: 22 Jan 2008, 23:00

Website: http://thunderwolf.freehost10.com/KaMMissionBuilder/index.php

Location: Netherlands

Post 09 Dec 2009, 13:23

I'll try playing around with it for a bit more...

This is my current (C#) code:
  Code:
Bitmap bmp = new Bitmap(width, height); for (int i = 0; i < width; i++) {     for (int j = 0; j < height; j++)     {         //put block data at coords into blockData         offset = (width * i) + j;         for (int k = 8 + (offset * 23); k < 23 + 8 + (offset * 23); k++)         {             blockData[k - (8 + (23 * offset))] = allBytes[k];         }         int heightInBMP = blockData[2];         Color c = new Color();         heightInBMP = Convert.ToInt32(Convert.ToDouble(heightInBMP) * 2.55);         c = Color.FromArgb(heightInBMP, heightInBMP, heightInBMP);         bmp.SetPixel(j, i, c);     } } bmp.Save("heightmap.bmp", System.Drawing.Imaging.ImageFormat.Bmp);[/quote]
~old sig
MissionBuilder v0.9f2 UPDATED!!
Defend The Outer Colony. fight for your king and uncover the secrets of this land.
Temporary version at
http://thunderwolf.x10hosting.com/index.php
"You can't defeat me, I've played Knights and Merchants"
<<

harold

Knight

Posts: 563

Joined: 19 Nov 2007, 23:00

Post 09 Dec 2009, 13:31

  Code:
Convert.ToInt32(Convert.ToDouble(heightInBMP) * 2.55); [/quote] Why??? You don't need doubles, and you certainly don't need to use Convert (which is evil!) [code](heightInBMP * 255)/100[/quote]
<<

Krom

User avatar

Knights Province Developer

Posts: 3282

Joined: 09 May 2006, 22:00

KaM Skill Level: Fair

Location: Russia

Post 09 Dec 2009, 13:33

Also keep in mind that all values ahould be unsigned.. probably you already did, but just in case
Knights Province at: http://www.knightsprovince.com
KaM Remake at: http://www.kamremake.com
Original MBWR/WR2/AFC/FVR tools at: http://krom.reveur.de
<<

Thunderwolf

User avatar

Crossbowman

Posts: 233

Joined: 22 Jan 2008, 23:00

Website: http://thunderwolf.freehost10.com/KaMMissionBuilder/index.php

Location: Netherlands

Post 09 Dec 2009, 13:56

  Code:
Convert.ToInt32(Convert.ToDouble(heightInBMP) * 2.55); [/quote] Why??? You don't need doubles, and you certainly don't need to use Convert (which is evil!) [code](heightInBMP * 255)/100[/quote][/quote] yeah.. uh.. I did write that code quickly.. updated it now though, it does generate the same image... [code]Also keep in mind that all values ahould be unsigned.. probably you already did, but just in case[/quote] bitmap.setpixel doesn't accept uint (?)... all values are positive though.
~old sig
MissionBuilder v0.9f2 UPDATED!!
Defend The Outer Colony. fight for your king and uncover the secrets of this land.
Temporary version at
http://thunderwolf.x10hosting.com/index.php
"You can't defeat me, I've played Knights and Merchants"

Return to “General Talk”

Who is online

Users browsing this forum: No registered users and 2 guests