[ODE] Speed up collision detection
Marc Rochel
marc.rochel at udicom.de
Sat May 29 19:37:13 MST 2004
Hi !
I've got a trimesh with about 20k triangles building a quake-like map and
about 70 spheres in it rolling around. Everything is put into one hashspace.
I profiled it and I was supprised that 32% of the time is spent in
dxHashSpace::collide(void *,void (*)(void *,struct dxGeom *,struct dxGeom
*)) (collision_space.obj) (including childs). There are 1.6% spent in
Nearcallback, but 20% including childs, so I think my nearcallback is not
the problem. I only call dCollide with 3 contacts, dJointCreateContact &
dJointAttach, and some dGeomIsSpace and dGeomGetBody.
So I wonder if there is some docu on how to set up the spaces to speed up
collision detection? Or is it actually the bottleneck and I can't speed it
up? (I thought opcode is fast though)
I'm using msvc6, optimizations on.
Marc
---- here the profiling output:
Profile: Function timing, sorted by time
Date: Sat May 29 17:29:42 2004
Program Statistics
------------------
Command line at 2004 May 29 17:28:
"C:\meinedat\projects\WoW\Client\Release\Client"
Total time: 18795,658 millisecond
Time outside of functions: 63,846 millisecond
Call depth: 43
Total functions: 2681
Total hits: 22433007
Function coverage: 45,8%
Overhead Calculated 2
Overhead Average 2
Module Statistics for client.exe
--------------------------------
Time in module: 18731,813 millisecond
Percent of time in module: 100,0%
Functions in module: 2681
Hits in module: 22433007
Module function coverage: 45,8%
Func Func+Child Hit
Time % Time % Count Function
---------------------------------------------------------
5399,184 28,8 5421,286 28,9 1 Visual::LoadMap(char *)
(visual.obj)
1434,367 7,7 17561,909 93,8 261 CWinThread::PumpMessage(void)
(mfc42.dll)
1180,828 6,3 6023,526 32,2 417 dxHashSpace::collide(void
*,void (*)(void *,struct dxGeom *,struct dxGeom *)) (collision_space.obj)
933,254 5,0 4962,155 26,5 3061577 collideAABBs(struct dxGeom
*,struct dxGeom *,void *,void (*)(void *,struct dxGeom *,struct dxGeom *))
(collision_space.obj)
780,385 4,2 791,976 4,2 42237 Visual::MoveVisObject(class
ZObject *,float const *,float const *) (visual.obj)
530,934 2,8 1160,839 6,2 220503
Opcode::SphereCollider::_CollideNoPrimitiveTest(class Opcode::AABBNoLeafNode
const *) (opc_spherecollider.obj)
499,602 2,7 2876,309 15,4 71822 dCollideSTL(struct dxGeom
*,struct dxGeom *,int,struct dContactGeom *,int)
(collision_trimesh_sphere.obj)
346,859 1,9 346,859 1,9 1651141 csArray<struct
csHashElement,class csArrayElementHandler<struct csHashElement>,class
csArrayMemoryAllocator<struct csHashElement> >::csArray<struct
csHashElement,class csArrayElementHandler<struct csHashElement>,class
csArrayMemoryAllocator<struct csHashElement> >(class csArray<struct
csHashElement,class csArrayElementHandler<struct csHashElement>,class
csArrayMemoryAllocator<struct csHashElement> > const &) (hashmap.obj)
310,566 1,7 310,566 1,7 1475592 dDOT(float const *,float
const *) (clientdlg.obj)
309,400 1,7 314,116 1,7 5 CWnd::ShowWindow(int)
(mfc42.dll)
300,608 1,6 3679,614 19,6 241047 NearCallback(void *,struct
dxGeom *,struct dxGeom *) (physics.obj)
296,372 1,6 649,412 3,5 333 csHashMap::csHashMap(unsigned
int) (hashmap.obj)
282,980 1,5 282,980 1,5 1535903
getVirtualAddress(int,int,int,int) (collision_space.obj)
251,493 1,3 262,875 1,4 1 csEventQueue::Dispatch(struct
iEvent &) (cseventq.obj)
213,689 1,1 216,848 1,2 594 Visual::CreateVisObject(class
ZObject *) (visual.obj)
184,247 1,0 675,658 3,6 2975 dxHashSpace::collide2(void
*,struct dxGeom *,void (*)(void *,struct dxGeom *,struct dxGeom *))
(collision_space.obj)
177,471 0,9 262,007 1,4 245859 GetContactData(float const
(&)[4],float,float const * const,float const * const,float const *
const,float &,float &,float &) (collision_trimesh_sphere.obj)
165,112 0,9 1736,974 9,3 71822
Opcode::SphereCollider::Collide(struct Opcode::SphereCache &,class
IceMaths::Sphere const &,class Opcode::Model const &,class
IceMaths::Matrix4x4 const *,class IceMaths::Matrix4x4 const *)
(opc_spherecollider.obj)
144,740 0,8 172,469 0,9 11 Visual::Render(void)
(visual.obj)
143,873 0,8 7839,715 41,9 417 World::Iterate(void)
(world.obj)
137,971 0,7 187,602 1,0 279046
Opcode::SphereCollider::SphereContainsBox(class IceMaths::Point const
&,class IceMaths::Point const &) (opc_spherecollider.obj)
129,859 0,7 129,859 0,7 585229 _dGeomGetBody
(collision_kernel.obj)
124,531 0,7 238,187 1,3 71822
Opcode::SphereCollider::InitQuery(struct Opcode::SphereCache &,class
IceMaths::Sphere const &,class IceMaths::Matrix4x4 const *,class
IceMaths::Matrix4x4 const *) (opc_spherecollider.obj)
118,412 0,6 408,136 2,2 40966 dxQuickStepper(struct dxWorld
*,struct dxBody * const *,int,struct dxJoint * const *,int,float)
(quickstep.obj)
113,227 0,6 113,227 0,6 501554 _dGeomIsSpace
(collision_kernel.obj)
100,927 0,5 100,927 0,5 320858 _dNormalize4 (odemath.obj)
97,432 0,5 97,432 0,5 384055
Opcode::SphereCollider::SphereAABBOverlap(class IceMaths::Point const
&,class IceMaths::Point const &) (opc_spherecollider.obj)
93,854 0,5 93,854 0,5 499844 dxGeom::AABBTest(struct
dxGeom *,float * const) (collision_kernel.obj)
93,854 0,5 93,854 0,5 499844 dxTriMesh::AABBTest(struct
dxGeom *,float * const) (collision_kernel.obj)
68,042 0,4 68,042 0,4 303983
Opcode::Collider::ContactFound(void) (opc_planescollider.obj)
60,158 0,3 85,220 0,5 75630 Opcode::Collider::Setup(class
Opcode::BaseModel const *) (opc_planescollider.obj)
59,035 0,3 59,035 0,3 216374 _dSetZero (matrix.obj)
58,893 0,3 58,893 0,3 131013 findLevel(float * const)
(collision_space.obj)
55,872 0,3 55,872 0,3 303983
Opcode::AABBNoLeafNode::HasNegLeaf(void) (opc_planescollider.obj)
55,648 0,3 752,690 4,0 150
InternalGetPluginMetadata(char const *,class csRef<struct iDocument> &)
(loadlib.obj)
55,478 0,3 198,551 1,1 20093
Opcode::OBBCollider::_Collide(class Opcode::AABBNoLeafNode const *)
(opc_obbcollider.obj)
55,291 0,3 137,189 0,7 42665 dxStepBody(struct dxBody
*,float) (util.obj)
54,066 0,3 54,066 0,3 303983
Opcode::AABBCollisionNode::IsLeaf(void) (opc_planescollider.obj)
54,066 0,3 54,066 0,3 303983
Opcode::AABBNoLeafNode::HasPosLeaf(void) (opc_planescollider.obj)
53,716 0,3 53,765 0,3 246217
IceCore::Container::Add(float) (opc_raycollider.obj)
53,716 0,3 53,765 0,3 246217
IceCore::Container::Add(unsigned int) (opc_raycollider.obj)
53,427 0,3 3229,376 17,2 78103 _dCollide
(collision_kernel.obj)
49,631 0,3 49,631 0,3 279046
IceMaths::Point::SquareDistance(class IceMaths::Point const &)
(opc_spherecollider.obj)
47,978 0,3 47,978 0,3 164966
Opcode::AABBCollisionNode::GetPos(void) (opc_planescollider.obj)
47,978 0,3 47,978 0,3 164966
Opcode::AABBNoLeafNode::GetPos(void) (opc_planescollider.obj)
46,770 0,2 59,177 0,3 2975
Visual::SetCameraDirect(struct iSector *,float *,float *) (visual.obj)
46,061 0,2 56,595 0,3 29532 SOR_LCP(int,int,float *,int
*,struct dxBody * const *,float const *,float *,float *,float *,float
*,float *,float const *,int *,struct dxQuickStepParameters *)
(quickstep.obj)
45,322 0,2 17610,869 94,0 1 CDialog::DoModal(void)
(mfc42.dll)
42,912 0,2 87,437 0,5 32334 _dBodySetRotation (ode.obj)
40,613 0,2 40,613 0,2 181480
Opcode::AABBNoLeafNode::GetNeg(void) (opc_spherecollider.obj)
40,613 0,2 40,613 0,2 181480
Opcode::AABBTreeNode::GetPrimitives(void) (opc_spherecollider.obj)
39,214 0,2 39,214 0,2 75630
IceCore::Container::GetEntries(void) (opc_planescollider.obj)
39,214 0,2 39,214 0,2 75630
Opcode::AABBCollisionTree::GetNodes(void) (opc_planescollider.obj)
39,214 0,2 39,214 0,2 75630
Opcode::AABBNoLeafTree::GetNodes(void) (opc_planescollider.obj)
39,214 0,2 39,214 0,2 75630
Opcode::AABBQuantizedNoLeafTree::GetNodes(void) (opc_planescollider.obj)
39,214 0,2 39,214 0,2 75630
Opcode::AABBQuantizedTree::GetNodes(void) (opc_planescollider.obj)
39,108 0,2 39,108 0,2 133038
IceMaths::Matrix3x3::Matrix3x3(void) (opc_optimizedtree.obj)
39,108 0,2 39,108 0,2 133038
IceMaths::Matrix4x4::Matrix4x4(void) (opc_optimizedtree.obj)
39,108 0,2 39,108 0,2 133038 IceMaths::Point::Point(void)
(opc_optimizedtree.obj)
39,108 0,2 39,108 0,2 133038 IceMaths::Point::operator
float *(void) (opc_optimizedtree.obj)
39,108 0,2 39,108 0,2 133038 IceMaths::Point::operator
float const *(void) (opc_optimizedtree.obj)
39,108 0,2 39,108 0,2 133038
Opcode::AABBTreeNode::GetAABB(void) (opc_optimizedtree.obj)
39,108 0,2 39,108 0,2 133038
Opcode::CollisionFace::CollisionFace(void) (opc_optimizedtree.obj)
39,108 0,2 39,108 0,2 133038
Opcode::QuantizedAABB::QuantizedAABB(void) (opc_optimizedtree.obj)
:
:
More information about the ODE
mailing list