size in HeightFieldGeometry() and params in terrain.cfg ?

mamairaja

01-11-2009 18:07:14

Hi
This is my experience with creating a HeightFieldGeometry.

I have created the HeightField using xhf file.

NxOgre::ResourceSystem::getSingleton()->openArchive("media", "file:C:/nxs");
NxOgre::HeightField* hf= NxOgre::HeightFieldManager::getSingleton()->load("media:terrain.xhf");
NxOgre::HeightFieldGeometry* hfg = new NxOgre::HeightFieldGeometry(hf, NxOgre::Vec3(1000,200,1000));
hfg->setLocalPose(NxOgre::Matrix44(NxOgre::Vec3(0,200,0)));
mScene->createSceneGeometry(hfg);

terrain.cfg file

PageWorldX=1000
PageWorldZ=1000
MaxHeight=200

Have used the terrain.png which comes with Ogre (media\PCZAppMedia) to create the terrain.raw file. Used photoshop here.
used the below command to convert it to xhf
flour convert in: terrain.raw, into:heightfield, out:terrain.xhf, width:513, height:513

The Output

For some places of the terrain the hight is exactly correct. But some places it's not.

I need to know the parameters I have used to create the HeightFieldGeometry should match with parametrs in terrain.cfg.
PageWorldX=1000
PageWorldZ=1000
MaxHeight=200
and
NxOgre::HeightFieldGeometry* hfg = new NxOgre::HeightFieldGeometry(hf, NxOgre::Vec3(1000,200,1000));

It's really appreciate if someone can explain the connection between parameters in terrain.cfg and terrain size in HeightFieldGeometry.

P.S. Sorry If some one almost asked the same question. I have searched the forum using a several keywords. But not managed to find a answer. I have followed series of wiki guides to create the hightmap. And made a own hightmap using 3dmax and managed to load it to ogre. I have one more steps to go. This is it.
So please answer!!!

Druha

04-11-2009 10:09:34


hfg->setLocalPose(NxOgre::Matrix44(NxOgre::Vec3(0,200,0)));

Here it is, there must be your terrain y/2 (in your case NxOgre::Vec3(0,100,0) ). Or in some cases of 16bit /8 bit images there is no need to setLocalPose at all.