Performance with CompoundShapes

Empire-Phoenix
Posts: 24
Joined: Sat Nov 07, 2009 7:57 pm

Performance with CompoundShapes

Post by Empire-Phoenix »

Well my problem is that Compound shapes seem to use exponentionally more power, when they collide depending on the objectcound.

When I have one CompoundShape (containing 190 boxshapes), that falls onto a simple box, Performance is quite nice, however when I use two CompoundShapes with 190 boxshapes each, the performance kinda breaks down.(As soon as they get near each other)

The Question is, how can I improve this? Are there any tricks to sort them like a Tree structure or so?
Are there alternatives that might work faster?
S.Lundmark
Posts: 50
Joined: Thu Jul 09, 2009 1:46 pm

Re: Performance with CompoundShapes

Post by S.Lundmark »

Hi,

I've successfully implemented a btCompoundShape with the btQuantizedBvh-tree structure. This reduced the collision costs for all btCompoundShapes by quite a lot. The change is quite large but I could talk you through it if you're interested. I haven't been able to send it to bullet yet since I have only implemented the convexCast for btCompoundShapes with the btQuantizedBvh. I will implement it for ray-casting early 2010.

Best regards,
Simon
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Performance with CompoundShapes

Post by Erwin Coumans »

Empire-Phoenix wrote:Well my problem is that Compound shapes seem to use exponentionally more power, when they collide depending on the objectcound.

When I have one CompoundShape (containing 190 boxshapes), that falls onto a simple box, Performance is quite nice, however when I use two CompoundShapes with 190 boxshapes each, the performance kinda breaks down.(As soon as they get near each other)

The Question is, how can I improve this? Are there any tricks to sort them like a Tree structure or so?
Are there alternatives that might work faster?
The btCompoundShape already uses a tree acceleration structure (btDbvt), so there shouldn't be a n^2 checks when two btCompoundShape objects collide. Can you reproduce this in a Bullet demo?

Cheers,
Erwin
sparkprime
Posts: 508
Joined: Fri May 30, 2008 2:51 am
Location: Ossining, New York

Re: Performance with CompoundShapes

Post by sparkprime »

making a shape out of a 10x10x10 cube of 0.1m boxes, and then building a stack of these compound shapes might be interesting
sparkprime
Posts: 508
Joined: Fri May 30, 2008 2:51 am
Location: Ossining, New York

Re: Performance with CompoundShapes

Post by sparkprime »

in fact, it would be better to test it using a compound shape made out of n pizza boxes on top of each other, so that ideally in a stack of such shapes, only the top and bottom box would be tested. You can then vary n and verify that the performance does not degrade.
sparkprime
Posts: 508
Joined: Fri May 30, 2008 2:51 am
Location: Ossining, New York

Re: Performance with CompoundShapes

Post by sparkprime »

If the compound shape is using BVH optimisation then is the only advantage to the btBvhTriangleMeshShape or the btGimpactTriangleMeshShape to do with memory consumption? Because typically we keep triangle meshes very simple when using them for physics shapes, so this is perhaps not such a big deal.