Why not implement OptimizedBvh on arbitrary shape?

wenweilv
Posts: 3
Joined: Mon Aug 04, 2008 3:12 am

Why not implement OptimizedBvh on arbitrary shape?

Post by wenweilv »

i read changelog, Allow btOptimizedBvh to be used for arbitrary objects, not just triangles,
but i can't find any implementation about this except triangle mesh.What happen? who can explain that?
wenweilv
Posts: 3
Joined: Mon Aug 04, 2008 3:12 am

Re: Why not implement OptimizedBvh on arbitrary shape?

Post by wenweilv »

would nobody like to help me?
User avatar
projectileman
Posts: 109
Joined: Thu Dec 14, 2006 4:27 pm
Location: Colombia

Re: Why not implement OptimizedBvh on arbitrary shape?

Post by projectileman »

You should use GIMPACT for that.

The btGImpactBvh class support both trimeshes and arbitrary shapes. And also it supports BVH vs BVH trees !!

Please take a look to the Extras/GIMPACT folder. The btGImpactCompoundShape class (in the btGImpactShape.h file) may be right for your project.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Why not implement OptimizedBvh on arbitrary shape?

Post by Erwin Coumans »

To accelerate compound/composite shapes, you can use btGImpactCompoundShape/btGImpactBvh indeed.

btOptimizedBvh is not restricted to triangle meshes anymore, so it can also be used for arbitrary shapes, see btMultiSapBroadphase::buildTree for an implementation example that builds a BVH of broadphases. Another option is btDbvt, which implements deformable AABB tree versus AABB tree, used for deformable / soft bodies.

We plan on unifying those 3 classes (btGImpactBvh,btOptimizedBvh and btDbvt) behind one interface in a future release. After that, we merge GIMPACT into the core src tree.
Hope this helps,
Erwin
wenweilv
Posts: 3
Joined: Mon Aug 04, 2008 3:12 am

Re: Why not implement OptimizedBvh on arbitrary shape?

Post by wenweilv »

Thansk for your help, but in class btCompoundCollisionAlgorithm, i found one comment that says "We will use the OptimizedBVH, AABB tree to cull potential child-overlaps". why? not implement OptimizedBVH on the btCompoundShape?
sparkprime
Posts: 508
Joined: Fri May 30, 2008 2:51 am
Location: Ossining, New York

Re: Why not implement OptimizedBvh on arbitrary shape?

Post by sparkprime »

So is gimpact really preferable to compound convex hulls for arbitrary collision geometry? I have just got the static world sorted out now, although I haven't yet scaled up the amount of world data to check performance is still good. For dynamic objects I was going to go down the convex decomposition route, but it sounds like this is the wrong idea.

My dynamic geometry includes cars, lamp posts, uprooted trees, aeroplanes, boats. It's intended to be a GTA-like game.

One advantage I can see with the compound approach is that one can use rounded shapes (e.g. spheres, cones, multispheres, etc) to add rounded corners to thinks that should roll. I made a nice bowling pin out of 4 primitives, and it rolls and wobbles quite realistically.

A disadvantage seems to be that compound objects are more likely to get "jammed" inside each other, as things can get stuck between the components of the compound object. Obviously this can be avoided, but it's another thing to worry about. Is the situation better with gimpact?

Also, speed is always a concern, it sounds like gimpact is faster.
User avatar
projectileman
Posts: 109
Joined: Thu Dec 14, 2006 4:27 pm
Location: Colombia

Re: Why not implement OptimizedBvh on arbitrary shape?

Post by projectileman »


A disadvantage seems to be that compound objects are more likely to get "jammed" inside each other, as things can get stuck between the components of the compound object. Obviously this can be avoided, but it's another thing to worry about. Is the situation better with gimpact?

Also, speed is always a concern, it sounds like gimpact is faster.
It depends.

btOptimizedBVH is better for static tri meshes like terrains.

btGImpactBvh is more suitable for moveable trimeshes or moveable compounds those their form doesn't change in the simulation. (non deformable).

and btDbvt behaves well for soft-deformable bodies.
sparkprime
Posts: 508
Joined: Fri May 30, 2008 2:51 am
Location: Ossining, New York

Re: Why not implement OptimizedBvh on arbitrary shape?

Post by sparkprime »

I see...

I take it those classes you mention are just the datastructures. I'm not sure what collision shapes correspond to those datastructures...

btOptimisedBvh is only used in btBvhTriangleMeshShape?

btGimpactBvh is used in all the gimpact shapes? (i.e. just compound and trimesh)

dbvt is used for the softbody shape only?


There also seem to be a broadphase algorithm that uses dbvt. I guess the thing about broadphase is that at least some of the objects move so btOptimisedBvh is way out.

is btGimpactBvh's tree dynamic?

I don't really see what is the difference between btGimpactBvh and btOptimizedBvh.
User avatar
projectileman
Posts: 109
Joined: Thu Dec 14, 2006 4:27 pm
Location: Colombia

Re: Why not implement OptimizedBvh on arbitrary shape?

Post by projectileman »

is btGimpactBvh's tree dynamic?

I don't really see what is the difference between btGimpactBvh and btOptimizedBvh.
btGimpactBvh allows moveable trimeshes and btOptimizedBvh doesn't.

btGimpactBvh could be dynamic (for deformables) by calling the refit function, but I haven't tested this feature yet.