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.

DarkBASIC Professional Discussion / how does making terrains through height maps work?

Author
Message
frugi
18
Years of Service
User Offline
Joined: 6th Jul 2008
Location:
Posted: 20th Jul 2011 21:14
hi,
as far as i know dbpro makes for every pixel in the heightmap one dbpro unit for the terrain (correct me if that is wrong).
but what about the height? in which way does the brightness influence the height besides that dark is low and bright is high terrain?
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 20th Jul 2011 21:45 Edited at: 20th Jul 2011 21:47
Imagine a grayscale ....it starts in pure black and ends in white. There are several steps from maximun to minimun....so black is the lowest point and as more brightness, the greater the height.



Cheers.

I'm not a grumpy grandpa
KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 20th Jul 2011 21:46
That's pretty much it. Most terrain systems look at just the RED component of the heightmap color, so you get a value from 0 to 255. That's the value that is used to set the height of the vertices in the terrain.

Some terrain systems also use color heightmaps. The way they use the different colors seems to vary though.

frugi
18
Years of Service
User Offline
Joined: 6th Jul 2008
Location:
Posted: 20th Jul 2011 22:03
hmmm....
what i mean is i got a brightness value reaching vom 0 to 240 in microsoft pait. how much is the terrain increased per brightness unit?
i wrote an example in which the terrain is not even 100 units high which seems a bit low for the maximum of height to me.

KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 20th Jul 2011 22:10
try this command,

SET TERRAIN HEIGHTMAP 1, "Land.bmp"

frugi
18
Years of Service
User Offline
Joined: 6th Jul 2008
Location:
Posted: 20th Jul 2011 22:22
the command doesnt exist, where did you got it?
KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 20th Jul 2011 22:27
How old is your copy of DBPro?

It's part of the Advanced Terrain plugin that's now a part of DBPro.

frugi
18
Years of Service
User Offline
Joined: 6th Jul 2008
Location:
Posted: 20th Jul 2011 22:54
i still use cd version because i didnt like the design of the new editor , think i have to upgrade

by the way why is my terrain looking like in the image i attached?
Jimpo
21
Years of Service
User Offline
Joined: 9th Apr 2005
Location:
Posted: 20th Jul 2011 23:35
Quote: "i still use cd version because i didnt like the design of the new editor"
You can still use the old editor after you upgrade. In the main DBPro folder, it is located in the Editor folder. Just run editor.exe and it will be the old one.

frugi
18
Years of Service
User Offline
Joined: 6th Jul 2008
Location:
Posted: 20th Jul 2011 23:57
hey, nice to know somebody working on this time
i used the new editor now and it doesnt look as bad as i remember^^
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 21st Jul 2011 01:13 Edited at: 21st Jul 2011 01:14
Quote: "by the way why is my terrain looking like in the image i attached?"


That“s probably because of your texture size ....it must be multiple of 2 - 4 - 8 - 16 - 32 - 64 - 128 - 256 - 512 - 1024 etc.

However, this terrain format is now obsolete . I would use Advanced Terrain as KISTech said that now is free.

Cheers

I'm not a grumpy grandpa
Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 21st Jul 2011 20:56
Or buy Blitz Terrain (Or whatever it's called.) or use the demo of it.

It's even better than advanced terrain.

My signature is NOT a moderator plaything! Stop changing it!
frugi
18
Years of Service
User Offline
Joined: 6th Jul 2008
Location:
Posted: 22nd Jul 2011 02:38
Quote: "
That“s probably because of your texture size ....it must be multiple of 2 - 4 - 8 - 16 - 32 - 64 - 128 - 256 - 512 - 1024 etc."


i will try this

i just noticed that advanced terrain came with the latest upgrades
but there are no commands listed in the index anyway. neither of advanced terrain, nor of advanced physics nor of green ear(whatever this is ) is there any list of commands or better an upgrade of the command data in the editor?
frugi
18
Years of Service
User Offline
Joined: 6th Jul 2008
Location:
Posted: 22nd Jul 2011 02:55
@chafari
i used a 16x16 heightmap instead of the 10x10 before and its working
thanks
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 22nd Jul 2011 03:01
Here`s the advance terrain help files.

Ejoy it!!

I'm not a grumpy grandpa
leo877
18
Years of Service
User Offline
Joined: 6th Mar 2008
Location: san antonio, tx
Posted: 22nd Jul 2011 11:13
@chafari





Quote: "Here`s the advance terrain help files. "


cool this help me


frugi
18
Years of Service
User Offline
Joined: 6th Jul 2008
Location:
Posted: 23rd Jul 2011 17:08
very nice! thanks

by the way what is working faster, matrices or terrains?
because i think its nice to be able to edit every single tile's texture in matrices so i would choose them if they work as fast as terrains.
what are you using and why?
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 23rd Jul 2011 17:52 Edited at: 23rd Jul 2011 17:55
Quote: "by the way what is working faster, matrices or terrains?"



I prefer Advanced Terrains, but that depends ot the kind of floor you need. If it is going to be just a flat floor you can use matrix with low poly...if you need an irregular floor (mountains, cliffs, rivers ,lakes etc. you had better using AT.


Quote: "cool this help me"

@leo877

Enjoy it.

Cheers.

I'm not a grumpy grandpa
frugi
18
Years of Service
User Offline
Joined: 6th Jul 2008
Location:
Posted: 24th Jul 2011 23:24
hmm im working on a world builder again using terrain instead of matrices and im going crazy by searching the mistake in my code.
after putting in all variables the programm just ends with an error noise but i dont get any message. if i leave out the build terrain command it works(just without buildung the terrain of couse) but i cant imagine why. finally i chose to ask you all instead of wasting hours again



freemove20fps is just my function to move through the level

greetz frugi
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 25th Jul 2011 01:12
Your code works here (with trivial changes so I can see something). But there is a potential problem - the scale values should probably be floats not integers.

Here's the code I used:



Perhaps the problem is in the bit you didn't give us?
frugi
18
Years of Service
User Offline
Joined: 6th Jul 2008
Location:
Posted: 25th Jul 2011 12:02
i changed the scale variables to float but it didnt change anything.
i left out my freemove20fps() function which is the only part left i didnt show you. just leaving out the build terrain command makes it work without an error.
maybe im going out of range of the variables

i always put in the following:
heightmap$ = heightmap.bmp (it is 128x128 pixels black and white)
scalex# = 128
scaley# = 1
scalez# = 128
tilenumber = 128
textureimage$ = texture.bmp (it is 512x512 pixels)

otherwise i just can imagine that there is something wrong with the DB data. i never used AT before so i installed the update (U75).
maybe there is something else to do to make it work
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 25th Jul 2011 14:01
Quote: "i changed the scale variables to float but it didnt change anything."


It wouldn't in your case because you are using whole numbers anyway. I mentioned it because I was using values such as 3.0, 0.3 and 3.0 for the three values.

Your problem is almost certainly the tile value - 128 does sound excessively large and means your terrain has been split into 16384 limbs. In fact my laptop hangs when I try such a large value. Try a lower value such as 8 and see what happens.

If that doesn't work could you post your heightmap file and I'll test it here? I very much doubt the texture image is causing the problem.
frugi
18
Years of Service
User Offline
Joined: 6th Jul 2008
Location:
Posted: 25th Jul 2011 15:00
i changed variables back to integer.
then i put in 8 instead of 128 tiles per side.
it created a mountain that looks so nice that i hardly started crying
you saved my holidays!

i never believed that 128 would be a problem because 128x128 tiles always worked using matrices and i thought terrains work the same way.

i think i didnt understand the 'set texture split' command
i thought i have to split it into as many parts as the heightmap includes so im a bit confused now

but it works
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 25th Jul 2011 15:26
Glad that was it.

The idea of the set terrain split command is to enable you to have detailed terrains without exceeding DBPro's poly count limits or degrading performance too much.

This is achieved by breaking the terrain into smaller "limbs" each of which is sufficiently detailed to look good, but not so many that you create other problems for DBPro. It is very different from the tiling used with matrices. Each limb will consist of a grid of about 32x32 vertices and polys. So, for example, a split value of 8 will give you a 8x8 grid of limbs, i.e. 64 limbs, and each of these will have about 1000 vertices (I'm not sure of the exact rule). The update terrain command should be used each loop and tells DBPro which limbs are in view of the camera at any instant. This helps performance somewhat.

You can see which limbs correspond to different parts of your terrain by experimenting with the hide limb and show limb commands. With 64 limbs the limbs will be numbered from 0 to 63.

Enjoy your holidays.
frugi
18
Years of Service
User Offline
Joined: 6th Jul 2008
Location:
Posted: 26th Jul 2011 19:15
i think i have to pay a teacher or something sitting next to me helping me out all time

1. problem
2. problem solved
3. back to 1.




i was wasting hours again finding the mistake in the 7 lines before the 'do'
i think its once again just something i cant know ^^
when i start the programm i just get a black screen, nothing else

i hope i dont annoy you with all my individual code questions
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 26th Jul 2011 20:52 Edited at: 26th Jul 2011 20:53
Use this piece of code . You don“t need to add any image...just copy the code and save first to dba and then execute the dba.




Cheers.

I'm not a grumpy grandpa
frugi
18
Years of Service
User Offline
Joined: 6th Jul 2008
Location:
Posted: 26th Jul 2011 21:37
i solved the problem, i had to delete the bitmap i created

thanks for example code, it looks amazing

greetz frugi

Login to post a reply

Server time is: 2026-07-11 12:02:29
Your offset time is: 2026-07-11 12:02:29