Heightmap or mesh using flour?

netsurferj

01-07-2008 15:58:18

Hi

I am having difficulty with the heightmap using nxogre. Everything compiles and runs fine, its just that the heigtmap is not set up as it is supposed to.
I set it up as I found in the forum. I converted my .png to .raw and then to .xhf using flour. My image size is 513x513. If I make it 512 (power of 2) it still doesnt work (flour states its 362x362). In my terrain.cfg file the terrain size is 8000x8000 and height is 100.
I am using a convex mesh as the collision model for my robot. My code is:

Loading the resources:
NxOgre::Resources::ResourceSystem::getSingleton()->addHeightfieldAs("file://terrain5.xhf", "heightfile");
NxOgre::Resources::ResourceSystem::getSingleton()->addMeshAs("file://robot.mesh.nxs","robot-mesh");


Creating heightfield and actors:

mgr->setWorldGeometry("terrain1.cfg");
NxOgre::Resources::Heightfield* hf = NxOgre::Resources::ResourceSystem::getSingleton()->getHeightfield("heightfile");

mScene->createActor("terr", new NxOgre::Terrain(hf, NxOgre::float3(8000,100,8000), "", "centering: xz-above, hole-material: 65535"), Ogre::Vector3(0, 0, 0), "static: yes");


And the robot body:

NxOgre::Resources::Mesh *convexMesh = NxOgre::Resources::ResourceSystem::getSingleton()->getMesh("robot-mesh");
mScene->createBody("moo; robot.mesh", new NxOgre::Convex(convexMesh), Ogre::Vector3(980,108,2710), NxOgre::ActorParams("Mass: 10"));


The robot is position in the sky (108), so when the game starts, the robot falls to the ground, and collides with a floor (I set floor to no when I created the scene), but does not collide with the terrain, if the terrain height is set to 0 (float3(8000,0,8000)). When it is set to 100 as in the code above, it lands in the air and with remote debugger I get the following image:



I was wondering if using a mesh would resolve all these problems, and if it would need more processing power?

netsurferj

01-07-2008 16:34:24

Hi

I just found that changing the pose of the actor changes up to where it is displayed in the remote debugger. When I changed the create actor code to:
mScene->createActor("terr", new NxOgre::Terrain(hf, NxOgre::float3(8000,100,8000), "", "centering: xz-above, hole-material: 65535"), Ogre::Vector3(2000, 0, 0), "static: yes"); I found the following results in the remote debugger:


What I would like to know, is how can I allign the visual terrain with this nxogre terrain?

thanx

netsurferj

03-07-2008 16:10:56

I tried tilting the image clockwise and flipping it horizontally but nothing worked. I saw on another forum that "the new version of flour" will support custom image sizes, but I could not find this version? If someone could please help me with this I would appreciate it, as I just could not get the heigtmaps alligned.

thanx

betajaen

03-07-2008 16:25:10

I'm working on Flour 0.2 now which supports custom width/heights for images as well as creating and converting cloth meshes.

netsurferj

03-07-2008 18:22:29

Would that solve my problem though?

betajaen

03-07-2008 18:33:08

Most likely.

netsurferj

06-07-2008 17:32:08

Hi

Sorry to bother like this, I saw a post that someone created a heightmap and a "NxOgre heightmap" with the 0.9 code: new NxOgre::TerrainShape("HumanZone513x513.raw"
and they claimed it worked, and I would like to know if it is wise to switch back to 0.9 (as the old physX would not be supported?). Or is there some other way of creating the terrain (from a .mesh file perhaps), so it is collidable?

I saw the post: http://www.ogre3d.org/phpBB2addons/viewtopic.php?t=678&highlight=create+terrain+mesh about a "world mesh" using NxScene, but I did not quite understand it, as the terrain is split up into little pieces instead of just one big terrain?

Thanx

betajaen

06-07-2008 17:34:21

No. Never switch back to 0.9, if you have to. Flour will be out soon, from which you can specify widths and heights of terrains.

jonnys

25-07-2008 04:43:03

No. Never switch back to 0.9, if you have to. Flour will be out soon, from which you can specify widths and heights of terrains.

Sorry to start back a dormant topic....

I have a few questions
1. What are the limitations with flour currently? (Because I created a height map and use flour to create the .xhf file and it looks like crap :) )
2. When will the new flour be released?

betajaen

25-07-2008 09:21:06

Flour will be released when I release NxOgre; which has three things to go - Cloth, Character (Basic), ContactModifier and ActorParams.

jonnys

25-07-2008 14:52:14

Ok thanks...dont rush it..take your time. :)