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 / can i change heightmap, texture, scale,.... of an existing terrain ?

Author
Message
frugi
18
Years of Service
User Offline
Joined: 6th Jul 2008
Location:
Posted: 27th Jul 2011 00:06
im working on my own map editor and currently i work like this:

always rebuilding the terrain is a very unefficient way to work so there must be something else i think

i hope you got some ideas

cheers
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 27th Jul 2011 00:54
If you want to change just the height of your terrain, instead of rebuilding the whole map just add some code like:



Do you prefer much more this terrain type than Advanced Terrain ??...this is the old terrain that nowaday is obsolete....If I had to use old terrain or just matrix, I will prefer much more the matrix one for sure.


Cheers.

I'm not a grumpy grandpa
frugi
18
Years of Service
User Offline
Joined: 6th Jul 2008
Location:
Posted: 27th Jul 2011 10:07
Quote: "
make object terrain 1
set terrain heightmap 1,heightmap$
build terrain 1
"


i think this is advanced terrain im using isnt it?

what i want to do is making a terrain and change its scale but also texture and its heightmap. i want to do this because i want to have a programm allowing you to edit the heightmap and see the changes instantly on the other half of the screen.

i attached something like a blueprint of the design so that you can imagine what i mean
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 27th Jul 2011 13:18 Edited at: 27th Jul 2011 14:26
Quote: "i think this is advanced terrain im using isnt it?"


Not ...it isn`t, it is the old terrain type.



Now I think I have understood you...what you need is something like a terrain editor don`t you? .Have a look to one of my old projects.

Edited Sorry frugi...I realize now that you are right...you are using advanced terrain, but you miss half of the commands.



if you add a detail texture and you set the terrain light you will see the difference.


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: 27th Jul 2011 22:17
To do realtime terrain modification, you'll need to stop using advanced terrain, and switch to another terrain engine, like blitz terrain. I believe that there are examples on how to modify terrains in real time. (But this may be a pay for only feature)

My signature is NOT a moderator plaything! Stop changing it!
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 27th Jul 2011 22:53 Edited at: 27th Jul 2011 22:54
Quote: "To do realtime terrain modification, you'll need to stop using advanced terrain"


Yes you are right ! but we can use other methods like matrix in real time or object plains.



Cheers.

I'm not a grumpy grandpa
frugi
18
Years of Service
User Offline
Joined: 6th Jul 2008
Location:
Posted: 28th Jul 2011 11:06
hey chafari, realy nice editor you made,great work!
it is for making heightmaps isnt it?
and how did you make it work using mouse?
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 28th Jul 2011 12:59 Edited at: 28th Jul 2011 13:01
Quote: "how did you make it work using mouse? "


I just set different heights to matrix vertex then use an other function to make the image to use with all hightmaps systems. Here is part of the code. In this example I show how to rise up or down matrix vertex. I'm just modifying one by one, but to make it smooth you have to rise up five point at a time.



Cheers.

I'm not a grumpy grandpa
frugi
18
Years of Service
User Offline
Joined: 6th Jul 2008
Location:
Posted: 28th Jul 2011 18:14
thanks i try to understand it later, my concentration is down these days
how do you save the heightmap.jpg? 99x99 pixels is a realy strange format... also there are 20x20 tiles and 21x21 vertices. i cant see any relation between these numbers.

i will celebrate the day on which i wont have anymore qustions

greetz frugi
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 28th Jul 2011 18:52 Edited at: 28th Jul 2011 18:58
The 99x99 pixels is just the portion of image that I grab with the function when I check for every matrix vertex, but once you get image you can make a bitmap paste the image in it and then with the comand copy bitmap you can scale automatically.So you can have an image and resize it to any size.

To understan better what I mean, have a look to this piece of code...just change the image name for an image you have in your PC.





Edited-I use this piece of code, to reduce all face capture to same size for my own lightmaper program.

Cheers.

I'm not a grumpy grandpa
frugi
18
Years of Service
User Offline
Joined: 6th Jul 2008
Location:
Posted: 28th Jul 2011 19:16
i think i understand
cheers
frugi
18
Years of Service
User Offline
Joined: 6th Jul 2008
Location:
Posted: 2nd Aug 2011 14:04
i cant understand why this

is making the red sphere follow the mouse even if the camera is rotated by any value
or did i just not find the crucial piece of code?

have a nice day!

frugi
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 2nd Aug 2011 15:33
Quote: "if mousex()>px then inc px,5
if mousex()<px then dec px,5
if mousey()>py then inc py,5
if mousey()<py then dec py,5"


The mouse moves free in whole screen....so we compare px and py to increase or decrease 5 units every move in order to snap to grid...if not the program will make an error when we set matrix height as we make the matrix 20*20 tiles.

Cheers.

I'm not a grumpy grandpa
frugi
18
Years of Service
User Offline
Joined: 6th Jul 2008
Location:
Posted: 2nd Aug 2011 17:35
ah now i understand
i think you missunderstood my question.
it was related to the matrix editor you attached and not to the code snipped.
if you add the 'control camera using arrowkeys' command you will see what i mean
if you move to tile 0,20 and turn around(180°) and move the mouse you will see the red dot move to the wrong direction.
and thats what i mean, how can i make the dot move independent of the angle of the camera rotation

(i hope this english is understandable )

thanks
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 2nd Aug 2011 18:35
Quote: "if you move to tile 0,20 and turn around(180°) and move the mouse you will see the red dot move to the wrong direction"


Does it ?? in my PC works fine


Cheers.

I'm not a grumpy grandpa
frugi
18
Years of Service
User Offline
Joined: 6th Jul 2008
Location:
Posted: 2nd Aug 2011 18:44
when i use exactly the code of the snippet it goes wrong directions after moving
i just added the moving command
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 2nd Aug 2011 19:35
Well ....the little piece of code snipet I showed you, was just a example on how to start....the example editor has much more code to prevent this error you mention. Under the matrix there is a hidden object and then I use the comand PICK OBJECT to get the exact position. Have a look to more code of the editor program.

Every time the mouse is on the matrix, the sphere will reposition trying to find a correct vertex to set matrix height.



If you have more doubts do not hesitate to ask

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: 2nd Aug 2011 19:48 Edited at: 2nd Aug 2011 19:49
The only down side to using matrices is they're hatefully slow.

Really, beginners or SMALL maps should use them, but they're pitiful for proper games as you cant multitexture, shader, shadow them. Plus they're really really slow.

Oh, and did I mention that they're slow? lol

My signature is NOT a moderator plaything! Stop changing it!
frugi
18
Years of Service
User Offline
Joined: 6th Jul 2008
Location:
Posted: 2nd Aug 2011 20:29
dont worry, i just want to use them for making heightmaps
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 2nd Aug 2011 20:32
Quote: "Oh, and did I mention that they're slow? lol"


Yes you did , if you read the post, you will notice that I talk about using a matrix just for generate a heightmap to use with any system....I know that matrices are not good for big landscapes, but even comercial engines don't have big landscapes.


Cheers.

I'm not a grumpy grandpa
frugi
18
Years of Service
User Offline
Joined: 6th Jul 2008
Location:
Posted: 3rd Aug 2011 01:11
i heard of vectors before maybe ones but thats it
my confusion is fulfilled
i looked for some information through google and also in the forum but i cant imagine what a vector is anyway.
maybe i was not born to do this.
if the whole thing goes on like this i think i have to surrender
...

think i need some success to become motivated

hopeful greetz

frugi
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 3rd Aug 2011 01:17
Don't give up !! . Just ask for help. You will find help somehow

Cheers.

I'm not a grumpy grandpa
frugi
18
Years of Service
User Offline
Joined: 6th Jul 2008
Location:
Posted: 3rd Aug 2011 01:53
i'm glad to know people like you on my side
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 3rd Aug 2011 02:24
Quote: "i'm glad to know people like you on my side"


This brings me good memories of when I taught my students

Cheers.

I'm not a grumpy grandpa

Login to post a reply

Server time is: 2026-07-11 03:38:05
Your offset time is: 2026-07-11 03:38:05