Performance of compound objects

marshall
Posts: 7
Joined: Wed Jun 13, 2007 6:14 pm

Performance of compound objects

Post by marshall »

I have setup a system where I generate hierarchies of compound objects that
break when a maximum impulse is applied. Why question concerns the performance
of doing something this way.

In it's simplest form I have a single compound object built of 50+ sub-objects.
I find that just allowing this object to drop without contact takes a long time
to solve. In long I mean 3-4 times as long as just simulating the objects
individually. Is this expected behavior or perhaps an error in my construction
of these compound objects? Should it be assumed that using compound
objects would generally take significantly longer to solve? Thanks.
marshall
Posts: 7
Joined: Wed Jun 13, 2007 6:14 pm

Post by marshall »

BTW, if it helps to diagnose all objects contained in a compound object are convex
objects.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Post by Erwin Coumans »

Does it mean 1 btRigidBody with a btCompoundShape with about 50 btConvexHullShape parts simulate slower then 50 btRigidBody each with a single btConvexHullShape?

I haven't profiled compound shapes in detail, and there is probably plenty of optimizations for large compounds. I will need to construct a reproduction case in one of the Bullet demos. Do you have time to help modifying a Bullet demo to demonstrate this issue?

Have you tried to enable Bullet's internal profiling? You can enable it by setting the define in LinearMath/btQuickProf.h (enable #define USE_QUICKPROF 1), and by create your custom version for debug drawer (derived from btIDebugDraw). Then set the debug mode to btIDebugDraw::DBG_ProfileTimings. This should output a textfile, in comma separated values that can be imported into a spreadsheet (like Excel etc).

You can enable and see timings in the demos by enabling the USE_QUICKPROF define in btQuickProf.h and pressing 'p' (this toggles btIDebugDraw::DBG_ProfileTimings and write a file to disk).

Thanks,
Erwin

By the way, if you need more then 32k rigid bodies, you can enable 32bit indices in the broadphase, BulletCollision/BroadphaseCollision/btAxisSweep3.h:

Code: Select all

//Enable BP_USE_FIXEDPOINT_INT_32 if you need more then 32767 objects
#define BP_USE_FIXEDPOINT_INT_32 1
marshall
Posts: 7
Joined: Wed Jun 13, 2007 6:14 pm

Post by marshall »

Yes, it's the case that has one rigid body and 50 convex hull shapes vs 50 rigid body
convex hull shapes.

I haven't tried the profiling yet. I'll give that a shot today. I'll also see about getting
you a test example.

Thanks!