Problem with OgreOde

wolfmanfx

22-05-2006 20:16:44

Hi sry for the Crosspost:
http://www.ogre3d.org/phpBB2/viewtopic.php?t=20742

tuan kuranes

23-05-2006 08:06:28

did you shift terrain origin to match OgreOde needs ?
using ("PositionX, PositionY, PositionZ") ?

Check LoadNow Option too to make sure all pages are loaded if you place objects on invisible page.

wolfmanfx

23-05-2006 08:18:23

Hi No i dont have shifted the terrain origin where i have do that and how much?

tuan kuranes

23-05-2006 09:05:19

at beginning and to make it match TSM origin as OgreOde landscape handling is TSM based.
TSM has 0,0,0 in a corner.
PLSM2 has 0,0,0 in the middle of terrain

You have to get terrain boundary (a getOption()) and shift from that boundary.

wolfmanfx

23-05-2006 20:12:23


Ogre::AxisAlignedBox tBox;
m_pSceneMgr->getOption("MapBoundaries",&tBox);

Ogre::Real tmp = 700;
m_pSceneMgr->setOption("PositionX",&tmp);
m_pSceneMgr->setOption("PositionZ",&tmp);


It wont shift @ all :( after these lines getOption for postion is again zero :(

tuan kuranes

24-05-2006 09:04:22

Weird, just checked plsm2 code and patch previously applied disaparread !
I'll recommit changes asap.
sorry.

wolfmanfx

24-05-2006 09:07:28

thx man :)

wolfmanfx

25-05-2006 11:03:39

checked cvs out but it doesnt work have u already submit the patch ?

tuan kuranes

25-05-2006 12:27:36

sorry I'm in the middle of a loads of modification at once, so I cannot commit just now. have to wait a bit. (imho tomorrow at most)

wolfmanfx

25-05-2006 13:20:13

OK good to know :)
Looking forward for the new fixes/features :) (like a child waiting for santa ^^)

tuan kuranes

26-05-2006 16:45:14

in CVS. Have to wati til anon CVS is updated. SF said it should be faster than before. No idea of the new wait time to expect.

wolfmanfx

27-05-2006 09:39:18

Shifting work now but it seems wired when shift PostionX and positionY


Ogre::AxisAlignedBox tBox;
m_pSceneMgr->getOption("MapBoundaries",&tBox);

Ogre::Real tmp;

tmp = tBox.getMaximum().x;
m_pSceneMgr->setOption("PositionX",&tmp);
m_pSceneMgr->setOption("PositionZ",&tmp);



The corner must be at 0 but isnot and if fly with the cam to the terrain the pages unload i mean when i arrive a page the page under me is unloading :(

wolfmanfx

27-05-2006 12:44:33

here the behaviour in video form http://stud3.tuwien.ac.at/~e0126198/terrain.divx

tuan kuranes

30-05-2006 09:10:52

You can use .cfg file option to set it too.
Seems that visibility/page loading doesn't take shifting in account...
I'll add that to do on my todo list, but that may take some time.

wolfmanfx

30-05-2006 09:23:08

mmm thats bad is there may a way to fit ode for plsm2 without to shift the terrain?

tuan kuranes

30-05-2006 09:31:35

you'll have to modify OgreOde to understand plsm2 ?
(could be just a "shifting" in the OgreOde calls to height ray queries.)

wolfmanfx

31-05-2006 10:33:48

What do u mean it is enough to shift the call in the geometry class?

tuan kuranes

31-05-2006 10:41:36

it should.

wolfmanfx

31-05-2006 10:49:53

Ok i will try this at night i hope it works :(

One question works the splatting5 shader again with Texture shadows as shadow receiver and is there a way to make the terrain a shadow caster now i am using splatting2 it works but i use Direc. light.

tuan kuranes

31-05-2006 12:16:03

Terrain as shadowcaster ? what fps that gives you ?
what other light it should work with ?
shader+shadow receive is a Work In progress

wolfmanfx

03-06-2006 12:45:59

I dont get it where to change the origin in OgreOdeGeometry cause when i drop a box not greater the pos 0,0 the functions dont get called at all.

SuperMegaMau

04-06-2006 14:59:58

Assuming you got it to work at positive values, changing the getHight method, you only have to create a new constructor to the OgreOdeGeometry.cpp.

This change I made is just a way arround, and is not the correct way to go, but it works well without any performance issues. Add the following next to the
TerrainGeometry::TerrainGeometry(const String& configfile,Space* space)

Leave the above constructor intact, and add this new constructor after:


TerrainGeometry::TerrainGeometry(const int nodes_per_side, const Real side_length, const Real max_height, Space* space)
{
_geom = dCreateTerrainCallback(getSpaceID(space),0,(dReal)max_height,(dReal)side_length,nodes_per_side,0,0);
_listener = 0;
_max_height = max_height;
_ray = Ray(Vector3::ZERO,Vector3::NEGATIVE_UNIT_Y);
_ray_query = World::getSingleton().getSceneManager()->createRayQuery(_ray);
registerGeometry();
}


As I remember well, this ignores the size of the terrain, and creates an infinite geometry, so the problem does not exist anymore.

hope it works...

wolfmanfx

04-06-2006 19:10:54

HI

i have tested it but now my boxes fly up and the collsion is complete false there must a thing u forgot to tell how should ODE handle the negative Coords where must i shift it?

SuperMegaMau

05-06-2006 16:43:36

Humm... don't know...

try this out, your heightAt function must look like this:


Real OgreOdeSystem::heightAt(const Vector3& position)
{
Vector3 resPosition;
SceneManager* sm = ogreSystem->getSceneManager();
Ogre::RaySceneQuery* rayQuery = sm->createRayQuery(Ray(Vector3::ZERO, Vector3::NEGATIVE_UNIT_Y));

//cast a ray into scene and get intersection point
Ogre::Ray checkRay(position, Vector3::NEGATIVE_UNIT_Y);
rayQuery->setRay(checkRay);
rayQuery->setQueryMask(RSQ_Height); //PLSM2 mask
rayQuery->execute();
RaySceneQueryResult& result = rayQuery->execute();
RaySceneQueryResult::iterator i = result.begin();

if (i != result.end() && i->worldFragment)
{
resPosition = i->worldFragment->singleIntersection;
}
return resPosition.y;
}


and, your terrain geometry must look like:
_terrain = new OgreOde::TerrainGeometry(257,2500.0,300.0,_world->getDefaultSpace());

using the new constructor. The arguments are: "size of the terrain heightmap", "size of the whole map (this is the value I defined in the cfg file to ScaleX. In the gen.cfg file I have a ScaleX=1)" and "max height (ScaleY)".

wolfmanfx

06-06-2006 03:01:37

thx now it works :)

but perfomance is horrible when i try to add the trees a createSingleStaticBox i got 0,2 fps is there something to tweak?



OgreOde::EntityInformer ei(m_pEntity,Matrix4::getScale(m_pSceneNode->getScale()));
ei.createSingleStaticBox ( SceneLoader::getSingletonPtr()->getOdeSpace());

SuperMegaMau

06-06-2006 12:13:27

thx now it works :)

but perfomance is horrible when i try to add the trees a createSingleStaticBox i got 0,2 fps is there something to tweak?


well... now you may have a problem with the size of the terrain. This change I post before, creates an infinite geometry for the terrain as I remember well, so maybe that is the problem. At the moment I have no free time to think about a better solution, when I do, I surelly help you.

One thing you can try, is to scale your meshes to a smaller size. I realize that the size of the mesh is very important to the performance of OgreOde, os ODE itself.

report further experiences :)