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.

Newcomers DBPro Corner / Heightmap to matrix landscape?

Author
Message
Mugen Wizardry
User Banned
Posted: 8th Aug 2011 17:37
Does anyone know where I can get a function that takes a heightmap, and perfectly creates a terrain from it? and controls the matrix's x & z segs so that I can have control over the quality of each tile?

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD AT Amazon.com!
Kezzla
16
Years of Service
User Offline
Joined: 21st Aug 2008
Location: Where beer does flow and men chunder
Posted: 9th Aug 2011 12:22
you could try using the
POINT(X,Y) command
within a nested for loop to get color data for your matrix height.

apply the data to the height of the matrix and it should work out nicely

heres an example of what I mean, you can use this code in your project however you will have to apply it to your matrix yourself



kezzla

Sometimes I like to use words out of contents
Mugen Wizardry
User Banned
Posted: 12th Aug 2011 22:08 Edited at: 12th Aug 2011 22:18
EDIT: This works, but its slow as heck. and when it DOES load my matrix, it is a flat plane, and the app sometimes mysteriously closes ><



CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD AT Amazon.com!
Kezzla
16
Years of Service
User Offline
Joined: 21st Aug 2008
Location: Where beer does flow and men chunder
Posted: 13th Aug 2011 01:30
you will still need to apply the data to the matrix with another nested loop.

also you have made a matrix ten units wide with 1000 segments which is gonna run really slow and probably will crash your system.

i'd set the segments to the same as the resolution variable

so something like


to apply the data to the matrix create a nested for loop based upon the previous code.

kezzla

Sometimes I like to use words out of contents
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 13th Aug 2011 03:25 Edited at: 13th Aug 2011 03:26
Hi there.
As the Question was ...Heightmap to matrix landscape?...My answer is:

We can use the piece of code under this lines...but I warn you that our friend Mobiius does not like at all this method .That is true that with big maps it is slow, but we can make several small maps. This example is slow because the matrix is 100*100 and the texture is 2048*2048, but we can make the map much smaller.

So ...for all of you and our friend Mobiius , I dedicate this code(is not mine...I found it somewhere in the forum)




Cheers.

I'm not a grumpy grandpa

Attachments

Login to view attachments
Mugen Wizardry
User Banned
Posted: 13th Aug 2011 15:36 Edited at: 13th Aug 2011 15:57
Ok. Now that it works. How do I get rid of the weird edge in this attached photo?

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD AT Amazon.com!

Attachments

Login to view attachments
Mugen Wizardry
User Banned
Posted: 13th Aug 2011 15:57
thats after u go off the map

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD AT Amazon.com!
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 13th Aug 2011 16:19 Edited at: 13th Aug 2011 16:30
Quote: "How do I get rid of the weird edge in this attached photo?"


That is a good question...I think that is beacause we a trying to read from the image every colour pixel, and we can help that just scaling the image to 102*102 . Try with this new scaled image.


Edit. That is not a misterious. if we pay attention to the image, we realize that up the image, it is completly black, so if we colorize in any paint program this first line to brighter colour, that problem disappears


Cheers.

I'm not a grumpy grandpa

Attachments

Login to view attachments
Mugen Wizardry
User Banned
Posted: 13th Aug 2011 16:38 Edited at: 13th Aug 2011 16:39
Ok. Now that we have that settled. is there any way to get rid of the seams such as the seams in this picture circled in red when i use set matrix trim, smooth out the matrix, and control the X, Y, and Z size of the matrix, with a variable?

New code:



CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD AT Amazon.com!

Attachments

Login to view attachments
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 13th Aug 2011 16:54 Edited at: 13th Aug 2011 17:01
Where have you taken this image from ? in my PC doesn't look like that



Are you rescaling texture to an .x file ??



Edited..
Quote: "set matrix trim 1, 2, 2"

oHH ...this is a complete texture ...we can not make that unless it we use a seemless texture, but we can arrange that texture for that purpose.


Cheers.

I'm not a grumpy grandpa

Attachments

Login to view attachments
Mugen Wizardry
User Banned
Posted: 13th Aug 2011 16:58 Edited at: 13th Aug 2011 16:58
I'm getting the picture from the same place you are. I decided to enhance the tiles using "set matrix trim" so the tiles dont blur when looking at them.

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD AT Amazon.com!
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 13th Aug 2011 17:03
If we use the same texture but first we arrange the texture, we can get rid of this ugly union.

Cheers.

I'm not a grumpy grandpa
Mugen Wizardry
User Banned
Posted: 13th Aug 2011 17:05
I don't understand.

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD AT Amazon.com!
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 13th Aug 2011 17:16
There are free programs to make a seemless image from an image. I have checked now, and looks bad like your example, I think that we had better don't trim matrix and we could use instead advanced terrain that can use a detail map. This example I gave you, was to show how we can build a landscape with a matrix, but is't a bit slow sometimes, and some friends like Mobiius never use it but we can play a bit with it haha

Cheers.

I'm not a grumpy grandpa
Mugen Wizardry
User Banned
Posted: 13th Aug 2011 17:23
The problem is, advanced terrains does not support the ability to save the terrain as a mesh with the detail map already applied to it >< Otherwise, I would ><

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD AT Amazon.com!
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 13th Aug 2011 17:43
Quote: "The problem is, advanced terrains does not support the ability to save the terrain as a mesh with the detail map already applied to it >< Otherwise, I would ><"


You can save advanced terrain to .x with the texture and detail map ....can't you ?

Cheers.

I'm not a grumpy grandpa
Mugen Wizardry
User Banned
Posted: 13th Aug 2011 17:48
I'm not sure. o.o If you could show me an example of this, that would be GREAT!

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD AT Amazon.com!
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 13th Aug 2011 18:33
Ok here is an example that load a dbo generated by Dbpro with a hightmap 32*32 and a detail map. You can convert Dbo to .x and apply texture . Download complete example



Cheers.

I'm not a grumpy grandpa

Attachments

Login to view attachments
Mugen Wizardry
User Banned
Posted: 13th Aug 2011 19:01
Thank you, this is perfect

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD AT Amazon.com!
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 13th Aug 2011 22:17
There's several examples of this already on the forum, did you try a search first?

It's a 7 year old snippet, so I'm not 100% sure if it'll still run today without modification, but it'll use a memblock instead of the point command.

http://forum.thegamecreators.com/?m=forum_view&t=33563&b=6

Mugen Wizardry
User Banned
Posted: 13th Aug 2011 22:49
Thanks guys!

I have decided Advanced Terrain / Blitz Terrain is the best way to go about it

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD AT Amazon.com!

Login to post a reply

Server time is: 2024-11-22 18:54:38
Your offset time is: 2024-11-22 18:54:38