Performance problem ; ManualMesh solution ?

mistigrii33

30-10-2011 21:20:46

Hi,

I'm making a labyrinth game, and for that purpose, i create a body for each wall of each case of my labyrinth.

The way i create a wall is the following one :

Body* boxBody = mRenderSystem->createBody(boxDesc, Vec3(posX, posY, posZ), "cube.mesh", bodyDesc);

When i deal with 10x10 labyrinth, i have a maximum of 10x10x4=400 body which represents each walls of the labyrinth, i haven't any performance problems.

But when i have a 25x25 labyrinth, my computer is really lagging when the camera is looking at these walls.

How can i solve this problem ?

I think about creating a ManualMesh, which represents all the labyrinth's wall.
About this solution, i don't understand how this NxOgre::ManualMesh works. I haven't found ressources which show how to use it, so if someone can give me some advice, it could be nice.

Thanks !

betajaen

31-10-2011 06:31:19

1. Don't use Bodies, use StaticGeometries for Walls. Bodies can fall over, StaticGeometries can't.
2. Don't make 25x25 StaticGeometries, make one and attach all the cubes into one. (ShapeGroups)
3. Last resort use a ManualMesh, it behaves and acts like the Ogre's ManualObject (a similar API and use). But personally, I would create the level up in a 3D modeller first then export it as a mesh. Rather than manually create the vertices, and work out all the triangles for each wall.

mistigrii33

03-11-2011 13:28:02

Hi betajean.

I can't create a mesh in a 3D modeller, i want the labyrinth to be generated in order to get random labyrinth.

About your advices, here is the way i understand them :

i have to create a NxOgre::ShapeDescriptions, then push all my ShapeDescription and add it to the scene.
Here is an example of how i do that :

NxOgre::BoxDescription boxDesc(NxOgre::Vec3(100,100,100));
NxOgre::BoxDescription boxDesc2(NxOgre::Vec3(50,50,50));
// etc ...

NxOgre::ShapeDescriptions s;
s.push_back(boxDesc);
s.push_back(boxDesc2);
//etc ...

mScene->createSceneGeometry(s);


Then, i create those walls in 3D, via the Ogre::ManualObject (i could do that by the NxOgre one, but i gave a try to Ogre's one first)
Is it the way your told me ?

Thanks ! :)

betajaen

03-11-2011 21:57:51

Actually, after a few days of posting. It occurred to me why your FPS is lagging. It isn't PhysX, or NxOgre. It's the amount of SceneNodes/Entities you are using at one time.

Look into reducing your batch count in Ogre, i.e. Use the Ogre Scene Geometry feature.

mistigrii33

04-11-2011 14:20:12

Actually, after a few days of posting. It occurred to me why your FPS is lagging. It isn't PhysX, or NxOgre. It's the amount of SceneNodes/Entities you are using at one time.

Look into reducing your batch count in Ogre, i.e. Use the Ogre Scene Geometry feature.

Indeed you're right. I try to add 25x25x4 walls in OGRE (without NxOgre), and it was lagging. The problem is solved now by making only one manual mesh.

Thanks for your concern about my problem.

Keep up the good work on NxOgre :)