What is the best Broadphase Interface for moving spheres?

Posted by Molmasepic on Game Development See other posts from Game Development or by Molmasepic
Published on 2012-05-05T18:18:05Z Indexed on 2012/11/11 11:30 UTC
Read the original article Hit count: 334

Filed under:
|
|

As of now I am working on optimizing the performance of the physics and collision, and as of now I am having some slowdowns on my other computers from my main.

I have well over 3000 btSphereShape Rigidbodies and 2/3 of them do not move at all, but I am noticing(by the profile below) that collision is taking a bit of time to maneuver.

    Each sample counts as 0.01 seconds.
  %   cumulative   self              self     total           
 time   seconds   seconds    calls  ms/call  ms/call  name    
 10.09      0.65     0.65                             SphereTriangleDetector::collide(btVector3 const&, btVector3&, btVector3&, float&, float&, float)
  7.61      1.14     0.49                             btSphereTriangleCollisionAlgorithm::processCollision(btCollisionObject*, btCollisionObject*, btDispatcherInfo const&, btManifoldResult*)
  5.59      1.50     0.36                             btConvexTriangleCallback::processTriangle(btVector3*, int, int)
  5.43      1.85     0.35                             btQuantizedBvh::reportAabbOverlappingNodex(btNodeOverlapCallback*, btVector3 const&, btVector3 const&) const
  4.97      2.17     0.32                             btBvhTriangleMeshShape::processAllTriangles(btTriangleCallback*, btVector3 const&, btVector3 const&) const::MyNodeOverlapCallback::processNode(int, int)
  4.19      2.44     0.27                             btSequentialImpulseConstraintSolver::resolveSingleConstraintRowGeneric(btRigidBody&, btRigidBody&, btSolverConstraint const&)
  4.04      2.70     0.26                             btSequentialImpulseConstraintSolver::resolveSingleConstraintRowLowerLimit(btRigidBody&, btRigidBody&, btSolverConstraint const&)
  3.73      2.94     0.24                             Ogre::OctreeSceneManager::walkOctree(Ogre::OctreeCamera*, Ogre::RenderQueue*, Ogre::Octree*, Ogre::VisibleObjectsBoundsInfo*, bool, bool)
  3.42      3.16     0.22                             btTriangleShape::getVertex(int, btVector3&) const
  2.48      3.32     0.16                             Ogre::Frustum::isVisible(Ogre::AxisAlignedBox const&, Ogre::FrustumPlane*) const
  2.33      3.47     0.15  1246357     0.00     0.00  Gorilla::Layer::setVisible(bool)
  2.33      3.62     0.15                             SphereTriangleDetector::getClosestPoints(btDiscreteCollisionDetectorInterface::ClosestPointInput const&, btDiscreteCollisionDetectorInterface::Result&, btIDebugDraw*, bool)
  1.86      3.74     0.12                             btCollisionDispatcher::findAlgorithm(btCollisionObject*, btCollisionObject*, btPersistentManifold*)
  1.86      3.86     0.12                             btSequentialImpulseConstraintSolver::setupContactConstraint(btSolverConstraint&, btCollisionObject*, btCollisionObject*, btManifoldPoint&, btContactSolverInfo const&, btVector3&, float&, float&, btVector3&, btVector3&)
  1.71      3.97     0.11                             btTriangleShape::getEdge(int, btVector3&, btVector3&) const
  1.55      4.07     0.10                             _Unwind_SjLj_Register
  1.55      4.17     0.10                             _Unwind_SjLj_Unregister
  1.55      4.27     0.10                             Ogre::D3D9HardwareVertexBuffer::updateBufferResources(char const*, Ogre::D3D9HardwareVertexBuffer::BufferResources*)
  1.40      4.36     0.09                             btManifoldResult::addContactPoint(btVector3 const&, btVector3 const&, float)
  1.40      4.45     0.09                             btSequentialImpulseConstraintSolver::setupFrictionConstraint(btSolverConstraint&, btVector3 const&, btRigidBody*, btRigidBody*, btManifoldPoint&, btVector3 const&, btVector3 const&, btCollisionObject*, btCollisionObject*, float, float, float)
  1.24      4.53     0.08                             btSequentialImpulseConstraintSolver::convertContact(btPersistentManifold*, btContactSolverInfo const&)
  1.09      4.60     0.07   408760     0.00     0.00  Living::MapHide()
  1.09      4.67     0.07                             btSphereTriangleCollisionAlgorithm::~btSphereTriangleCollisionAlgorithm()
  1.09      4.74     0.07                             inflate_fast

EDIT: Updated to show current Profile. I have only listed the functions using over 1% time from the many functions that are being used. Another thing is that each monster has a certain area that they stay in and are only active when a player is in said area. I was wondering if maybe there is a way to deactivate the non-active monsters from bullet(reactivating once in the area again) or maybe theres a different broadphase interface that I should use.

The current BPI is btDbvtBroadphase.

EDIT: Here is the Profile on the other computer(the top one is my main)

    Each sample counts as 0.01 seconds.
  %   cumulative   self              self     total           
 time   seconds   seconds    calls  ms/call  ms/call  name    
 12.18      1.19     1.19                             SphereTriangleDetector::collide(btVector3 const&, btVector3&, btVector3&, float&, float&, float)
  6.76      1.85     0.66                             btSphereTriangleCollisionAlgorithm::processCollision(btCollisionObject*, btCollisionObject*, btDispatcherInfo const&, btManifoldResult*)
  5.83      2.42     0.57                             btQuantizedBvh::reportAabbOverlappingNodex(btNodeOverlapCallback*, btVector3 const&, btVector3 const&) const
  5.12      2.92     0.50                             btConvexTriangleCallback::processTriangle(btVector3*, int, int)
  4.61      3.37     0.45                             btTriangleShape::getVertex(int, btVector3&) const
  4.09      3.77     0.40                             _Unwind_SjLj_Register
  3.48      4.11     0.34                             btBvhTriangleMeshShape::processAllTriangles(btTriangleCallback*, btVector3 const&, btVector3 const&) const::MyNodeOverlapCallback::processNode(int, int)
  2.46      4.35     0.24                             btSequentialImpulseConstraintSolver::resolveSingleConstraintRowLowerLimit(btRigidBody&, btRigidBody&, btSolverConstraint const&)
  2.15      4.56     0.21                             _Unwind_SjLj_Unregister
  2.15      4.77     0.21                             SphereTriangleDetector::getClosestPoints(btDiscreteCollisionDetectorInterface::ClosestPointInput const&, btDiscreteCollisionDetectorInterface::Result&, btIDebugDraw*, bool)
  1.84      4.95     0.18                             btTriangleShape::getEdge(int, btVector3&, btVector3&) const
  1.64      5.11     0.16                             btSequentialImpulseConstraintSolver::resolveSingleConstraintRowGeneric(btRigidBody&, btRigidBody&, btSolverConstraint const&)
  1.54      5.26     0.15                             btSequentialImpulseConstraintSolver::setupContactConstraint(btSolverConstraint&, btCollisionObject*, btCollisionObject*, btManifoldPoint&, btContactSolverInfo const&, btVector3&, float&, float&, btVector3&, btVector3&)
  1.43      5.40     0.14                             Ogre::D3D9HardwareVertexBuffer::updateBufferResources(char const*, Ogre::D3D9HardwareVertexBuffer::BufferResources*)
  1.33      5.53     0.13                             btManifoldResult::addContactPoint(btVector3 const&, btVector3 const&, float)
  1.13      5.64     0.11                             btRigidBody::predictIntegratedTransform(float, btTransform&)
  1.13      5.75     0.11                             btTriangleIndexVertexArray::getLockedReadOnlyVertexIndexBase(unsigned char const**, int&, PHY_ScalarType&, int&, unsigned char const**, int&, int&, PHY_ScalarType&, int) const
  1.02      5.85     0.10                             btSphereTriangleCollisionAlgorithm::CreateFunc::CreateCollisionAlgorithm(btCollisionAlgorithmConstructionInfo&, btCollisionObject*, btCollisionObject*)
  1.02      5.95     0.10                             btSphereTriangleCollisionAlgorithm::btSphereTriangleCollisionAlgorithm(btPersistentManifold*, btCollisionAlgorithmConstructionInfo const&, btCollisionObject*, btCollisionObject*, bool)

Edited same as other Profile.

© Game Development or respective owner

Related posts about c++

Related posts about ogre