Using arras's Terrain Tile manager

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.
Post Reply
fadi
Posts: 11
Joined: Tue Jan 08, 2008 3:15 pm

Using arras's Terrain Tile manager

Post by fadi »

Dear All,

Thank you for the great engine and forum.
I am a .Net developer (ok I have some c++ experience)and have been into software development for more than 8 years.

I tried using irrLicht.Net CP and it didn\t help me a lot due to the fact that i am trying to simulate Earth's terrain on a flat mesh(box) to simulate a nice surface flyby.

So and after some replies (thanks to all) on this forum I have decided to dig for my old c++ skills and give it a try using Arras's solution.

My problem is I can't make it work as expected.

I have a (say 2500x1250) bitmap image as bumpmap.
another 2500x1250 bitmap as normal colore earth's map (i.e to be used as texture).

I can't make things work. Can anyone share with me a code that will make things render normally?

Arras's any help or documentation for guys that are just starting to use your librariy so that I understand exactly how to use it?

I tried two or three samples found on the forums with me just trying to change JUST the bitmap or texture or bump file... i get wierd results.

Thank you all for your support,

Regards,

Fadi Kahhaleh
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

Send me your bumpmap and bitmap or post link to them. I'll look at it.
fadi
Posts: 11
Joined: Tue Jan 08, 2008 3:15 pm

Post by fadi »

Thanks arras for taking the time...
here you go...
I would def. like to learn why its not working with me and if there is anything else i can read to help me get started in all of this as i will need to fully understand your code and method :) .. (great method that is)

here is the site for the images...
I might try to find something with higher Resolution as I need to do a close flyby and still have a nice texture to be presented. any input is greatly welcomed.

www.oera.net/How2/TextureMaps2.htm

Download the following two:
"Earth Texture Natural Colors"
"Earth Elevation/Bump"

Again thanks for your time,

Fadi .K
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

Here you go ...Planet Earth:

Code: Select all

#include <irrlicht.h>
using namespace irr;

#include "ShTlTerrainSceneNode.h"

int main()
{
   IrrlichtDevice *device = createDevice(video::EDT_OPENGL, core::dimension2d<s32>(800, 600), 32, false, false, false, 0);
   
   video::IVideoDriver *driver = device->getVideoDriver();
   scene::ISceneManager* smgr = device->getSceneManager();
   
   // create terrain scene node
   ShTlTerrainSceneNode* terrain = new ShTlTerrainSceneNode(smgr, 2500, 1250, 1, 100);
   terrain->drop();
   
   // load height data from texture
   terrain->loadHeightMap("EarthElevation_2500x1250.jpg", 10); // 10 might be too much
   
   // load color map
   terrain->loadColorMap("EarthMap_2500x1250.jpg");
   
   // set detail texture
   terrain->setMaterialTexture(0, driver->getTexture("detailmap3.jpg"));
   
   // smooth normals
   terrain->smoothNormals();
   
   terrain->setMaterialFlag(video::EMF_LIGHTING, false);
   
   scene::ICameraSceneNode* camera = smgr->addCameraSceneNodeFPS();
   camera->setPosition(core::vector3df(1280,2,570));
   
   // set terrain to follow camera
   terrain->follow(camera);
   
   while(device->run())
   {
      driver->beginScene(true, true, video::SColor(255,100,101,140));

      smgr->drawAll();
      
      driver->endScene();
   }
   device->drop();

   return 0;
}
I did use detailmap3.jpg from Irrlicht media folder as texture, you may want to replace it with your own and perhaps create different tiles for land and water. Also since terrain size is the same as height map size, last row and last column of tile corners will have default height of 0. Height map have to be always terrain size+1 to set all properly.
fadi
Posts: 11
Joined: Tue Jan 08, 2008 3:15 pm

Post by fadi »

Arras,

Thank you very much, i'll check your code and report back.

umm i feel that i have a lack of understanding for this engine and your code. I have no idea how to do the seperate tiles getting seperate textures and the size and height thing that you mentioned.

Is there any documentation that you may refer me to so that i can better understand all of this? or if not, can I take more of your time and you or anyone on the forum explain it to me :oops:

thanks a lot guys...
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

Is there any documentation that you may refer me to so that i can better understand all of this? or if not, can I take more of your time and you or anyone on the forum explain it to me
As long as I am around you are welcomed :)

The best documentation is code itself. Look in to ShTlTerrainSceneNode.h you will find there list of all functions with descriptions.
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

Hey thats a really awesome idea. Might use it to create some kind of RISK styled game.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Post Reply