Creating my heightmap!

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
renegadeandy
Posts: 122
Joined: Sun May 25, 2008 11:14 pm
Location: Scotland
Contact:

Creating my heightmap!

Post by renegadeandy »

Hey!

I am trying to create some form of terrain for my game. It needs to be a level plain with a single fairly wide valley through the middle of it. I want each side of the valley to be nearly vertical.

I have tried creating several heightmaps to no success - usually most bear no resemblance to what i want, or dont display, or display a flat level ?!

E.g

Image

If somebody could draw me it, or explain exactly how to do it thta would be awesome - i have tried using Hme but its so incredibly simple I dont see how I am going wrong.

Thanks very much in advance,

Andy[/img]
Lekane
Posts: 31
Joined: Thu Jun 01, 2006 7:07 pm

Post by Lekane »

here is how heightmap works: the darker the lower, the brighter the higher... middle grey giving no offset

knowing this, go ahead and paint some nice dark grey surround by bright grey.

if too lazy, you can use ld3t or something to "sculpt" a terrain and output a heightmap
Mirror
Posts: 218
Joined: Sat Dec 01, 2007 4:09 pm

Post by Mirror »

photoshop is a good choice too ( for creating terrains ) ->filters->cloud
Ion Dune
Posts: 453
Joined: Mon Nov 12, 2007 8:29 pm
Location: California, USA
Contact:

Post by Ion Dune »

Mirror wrote:photoshop is a good choice too ( for creating terrains ) ->filters->cloud
A good $600 dollar choice. :lol:

http://www.google.com/search?hl=en&q=pe ... tnG=Search
greenya
Posts: 1012
Joined: Sun Jan 21, 2007 1:46 pm
Location: Ukraine
Contact:

Post by greenya »

For simple filters and good enough editing tools I would recommend Paint .NET ( http://www.getpaint.net/ ) -- it is freeware.

P.S.: It has Clouds filter and many more useful features.
marcos
Posts: 16
Joined: Fri May 16, 2008 5:38 pm

Post by marcos »

I would recommend you using GIMP:


I comes with a couple of extensions that you can use as a base which you can modify to get your desired terrain. The two lower left and upper right ones:
Image


Those extensions can be found in the GIMP main windows under: "Xtns->Pattern->Land", "Xtns->Pattern->FlatLand" and ""Xtns->Pattern->Land"
renegadeandy
Posts: 122
Joined: Sun May 25, 2008 11:14 pm
Location: Scotland
Contact:

Post by renegadeandy »

OK i have tried doing as you have said:

Image

However this outputs a very strange single stretch within my application - not anything which looks like its meant too at all.

Help!
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

In case you use the terrain scene node (and not the method addTerrainMesh) you're limited to 129x129 pixels for the heightmap. Moreover, the heightmap must be 2^n+1 in both directions for some n. The terrainmesh is not limited in size.
renegadeandy
Posts: 122
Joined: Sun May 25, 2008 11:14 pm
Location: Scotland
Contact:

Post by renegadeandy »

ahhh! Right, so i need to use addTerrainMesh - i will look into that- suppose I can just use the same heightmap?
renegadeandy
Posts: 122
Joined: Sun May 25, 2008 11:14 pm
Location: Scotland
Contact:

Post by renegadeandy »

I tried this :

Code: Select all

IAnimatedMesh* terrain = smgr->addTerrainMesh("Main_Ground",driver->createImageFromFile("C:/irrlicht-1.4/irrlicht-1.4/media/terrain-texture.jpg"),driver->createImageFromFile("C:/Users/Andy/Documents/Valley Attack/heightMaps/trial.bmp"),core::dimension2d< f32 >(10.0f, 10.0f),200.0f,core::dimension2d< s32 >(64, 64));
However it doesnt display anything - no errors - do I need to do something with the IAnimatedMesh object before it shows?

Thanks

Andy
radiant
Posts: 112
Joined: Fri Feb 22, 2008 8:04 pm
Location: Mexico

Post by radiant »

yes you have to ad a IAnimatedMeshSceneNode to go with that IAnimatedMesh...

Code: Select all

smgr->addAnimatedMeshSceneNode(terrain);
that should dysplay your mesh

best regards
renegadeandy
Posts: 122
Joined: Sun May 25, 2008 11:14 pm
Location: Scotland
Contact:

Post by renegadeandy »

ok - brilliant that now shows me a very large black canvas, no texture on it however?

Also the application now runs at an awful 15fps, why should this be the case - the terrain is only 200 by 600?
radiant
Posts: 112
Joined: Fri Feb 22, 2008 8:04 pm
Location: Mexico

Post by radiant »

ok.. one thing to note is that the heightmap u are providing(im talking about the one above) will look like a big prism with 2 holes/valeys inside... so u wont see anything... a heightmap should have... black in the lower parts and white on the higher parts... passing by gray inbetween...

about the texture... im guessing it will only put the texture on the faces u are suposed to see the texture... in this case... the top of the prism and inside the 2 wholes.. also... u need to disable lights or put some lights in the scene to see something...

best regards
renegadeandy
Posts: 122
Joined: Sun May 25, 2008 11:14 pm
Location: Scotland
Contact:

Post by renegadeandy »

Radient thanks for your extended support.

I cannot seem to create the correct heightmap having tried multiple times - they just dont appear how I would have thought - even using the cloud feature of Paint.NET I dont know how to edit it, without completly ruining it.

Can you provide an example which is fairly narrow about 200 wide and 600 long with a valley running through the middle, i.e a lower section.

As for the lights :

how do i set one
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Better disable lighting for the scene node by doing node->getMaterial(0).Lighting=false;
Post Reply