Slow with large mesh

christianshiel

21-06-2013 08:03:14

I'm using one of the provided examples in the bulletsharp demos - ConcaveRaycast demo.
I want to have a mesh that is a terrain say 500x500 verts. However when I make a mesh that exceeds 50x50 with this example program the framerate drop to 6-7.

Is my approach suitable? ie Am I using a suitable component for a terrain mesh?
Am I missing out on how to optimise something hence the slow FPS?

anthrax11

21-06-2013 23:36:06

Try splitting the terrain mesh into smaller chunks, maybe 20x20 or 30x30.
That way Bullet can use AABB tests to quickly reject parts of the terrain that aren't even close to colliding with other objects.

AlexeyKnyshev

22-06-2013 13:09:27

Yes, anthrax11 is right. You should optimize terrain building algorithm. It's slow because of linear complexity of trimesh - trimesh algo. For example, ogre has some close to you problem solution: paging. Take a look)

christianshiel

24-06-2013 12:07:03

I am using Mogre. I'm not aware of any terrain paging or terrain mouse picking capability.

You appear to imply I must create an Octree or similar style tree structure to reduce the amount of ray to triangle/quad tests bullet must do.

I had hoped bullet already had this functionality built in.

androlo

24-07-2013 00:26:15

Can't you use a simple heightfield instead of a regular mesh for a terrain? http://bulletphysics.com/Bullet/BulletFull/classbtHeightfieldTerrainShape.html