Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Colored height maps

Author
Message
Pfaber1
6
Years of Service
User Offline
Joined: 7th Jan 2018
Location: England
Posted: 28th Sep 2019 23:28
Could somebody please tell me the process of coloring a height map with more than one color . Up to now I've been using one color but wish to use 2 or more colors. Thanks for reading.
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 28th Sep 2019 23:45
When you are using a heightmap the image should be an 8 bit greyscale
https://www.appgamekit.com/documentation/Reference/3D/CreateObjectFromHeightMap.htm

But you can set it to use any texture to colour it with SetObjectImage ( objID, imageID, texStage )
https://www.appgamekit.com/documentation/Reference/3D/SetObjectImage.htm

fubarpk
fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
Pfaber1
6
Years of Service
User Offline
Joined: 7th Jan 2018
Location: England
Posted: 29th Sep 2019 13:03 Edited at: 29th Sep 2019 13:29
[img]null[/img]Thanks for the input fubarpk figured out I could add any texture and have managed to colour the walls and floor in different colours . the problem is all the floor and wall where they join I can't get a crisp line . The two colours sort of melt into one another . Is there a way to prevent this and have a sharp line . I have found a way of doing this but it's very slow . I'll put an image up so you can see what I'm talking about .

Attachments

Login to view attachments
Pfaber1
6
Years of Service
User Offline
Joined: 7th Jan 2018
Location: England
Posted: 29th Sep 2019 13:31 Edited at: 30th Sep 2019 11:44
It's ok I appear to have done it thanks for your help . A vast improvement
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 30th Sep 2019 11:47
Quote: "It's ok I appear to have done it "

Then perhaps you would be good enough to post your fix so that when others have a similar problem and find this thread with a search, they will know what to do without having to ask the question again.
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 30th Sep 2019 16:03 Edited at: 1st Oct 2019 07:59
Quote: "Then perhaps you would be good enough to post your fix so that when others have a similar problem and find this thread with a search, they will know what to do without having to ask the question again."

Yeah man, this has sparked my interest in height maps, since I have never used them in AGK.

I really love the fact that only the RED channel in the RGB is used for these gray scale values.

Seems like the same thing could be done with the Green and Blue to make a full color image that is converted as 3 gray scales. (vice versa)


Coding things my way since 1981 -- Currently using AppGameKit V2 Tier 1
Pfaber1
6
Years of Service
User Offline
Joined: 7th Jan 2018
Location: England
Posted: 5th Oct 2019 21:32 Edited at: 5th Oct 2019 21:42
All you have to do first create your height map . Then make a png file with the colors you want and then use this as a texture to put over the height map object . here's some code to help you understand .
[/code] texture1 = LoadImage("brick.png")
CreateObjectFromHeightMap(1,"amaze2.png",20480,1700,20480,1,0)
setobjectimage(1,texture1,1)[code lang=agk]
I don't know if this helps explain but it does work . Any questions ?
if the colors are bleeding into each other say you are using red and green in your paint program or whatever you use go around the bottom part of your height map and color it in one pixel in depth at the bottom of the wall or hill you have created and this will stop the colors running into each other hence red floor green walls . This is the best I can explain it . You can have different hills or walls in any color you choose . Thanks for reading.
Santman
13
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 6th Oct 2019 15:53
So.....you textured an object????
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 8th Oct 2019 13:54
Quote: "CreateObjectFromHeightMap(1,"amaze2.png",20480,1700,20480,1,0)
"

Holy height-maps Batman!

That is huge!

Quote: "So.....you textured an object????"

Yes, and we all had a first time we accomplished something new that was a breakthrough to making video games and I remember the excitement I had when learning to create 3D objects and texture them.

I just made some furniture that looked liked boxes put together, but it was great when I finally got a texture on it without stretching. (I imagine many a fellow started texturing 3d objects with crates)

Doing a whole map, but even better a maze, is much more ambitious, and he pulled it off. (nice work even if it isn't his first time playing with 3D)

Quote: "if the colors are bleeding into each other say you are using red and green in your paint program or whatever you use go around the bottom part of your height map and color it in one pixel in depth at the bottom of the wall or hill you have created and this will stop the colors running into each other hence red floor green walls . This is the best I can explain it . You can have different hills or walls in any color you choose ."

Great job, and thanks for sharing what you did rather than keeping it a secret, because it does help build the forums to be new user friendly, which benefits everyone.

I am looking forward to seeing what you come up with next.

Coding things my way since 1981 -- Currently using AppGameKit V2 Tier 1

Login to post a reply

Server time is: 2024-11-22 16:45:35
Your offset time is: 2024-11-22 16:45:35