Questions about btDbvt and frustum/occlusion culling

Post Reply
ola
Posts: 169
Joined: Sun Jan 14, 2007 7:56 pm
Location: Norway
Contact:

Questions about btDbvt and frustum/occlusion culling

Post by ola »

We're looking into using the btDbvt class for frustum culling and also potentially occlusion culling. I have looked into the BulletSAPCompleteBoxPruningTest code to get an idea of how to do it. Here are a few questions I'm left with.

In general, is this kind of frustum culling some of the fastest methods today? For comparision, we currently use bounding spheres on each scenegraph node and these are tested against the view frustum planes (so if a parent sphere that encloses any child spheres is completely visible/invisble, all children are visible/invisible, etc). If I understand the bounding volume tree method correctly then some information is pre-computed into the tree when it's generated/updated, and this helps speeding up the process per frame.

If we only want to use this for the culling (no collision detection or simulation, etc.):
- should I still use two btDbvt trees like the btDbvtBroadphase does (one for dynamic objects, the other for static ones)? I assume updating nodes in a huge tree costs more than updating a small one + two cull tests and this is the reason why we have two trees?
- what do I need to do with the btDbvt tree when changing a node's bounding box (when the object moved)? Is it enough to call btDbvt::update for that node?
- Are there any methods that should be called each frame to keep the tree up-to-date if a node was modified? (like for example btDbvt::optimizeIncremental / optimizeTopDown, etc?)
- Does it make sense to include the velocity and margin in the btDbvt::update call, or is that only useful for continuous collision detection?

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

Re: Questions about btDbvt and frustum/occlusion culling

Post by Erwin Coumans »

- should I still use two btDbvt trees like the btDbvtBroadphase does (one for dynamic objects, the other for static ones)? I assume updating nodes in a huge tree costs more than updating a small one + two cull tests and this is the reason why we have two trees?
You can use a single btDbvt tree. THere are a few reasons for using two trees for the broadphase, one of them is that you only need to query all objects of the DynTree versus the DynTree and all objects of the DynTree against the StaticTree. The DynTree has usually fewer objects, so you save a lot of tree traversals in the broadphase. For occlusion culling it probably won't matter much.
- what do I need to do with the btDbvt tree when changing a node's bounding box (when the object moved)? Is it enough to call btDbvt::update for that node?
An update should be enough.
- Are there any methods that should be called each frame to keep the tree up-to-date if a node was modified? (like for example btDbvt::optimizeIncremental / optimizeTopDown, etc?)
Not sure, please check the frustum/occlusion culling implementation in Extras/CDTestFramework
- Does it make sense to include the velocity and margin in the btDbvt::update call, or is that only useful for continuous collision detection?
No, you better set it to zero (there is an api for that).

Also, you might want to check out the Blender BGE source code, it uses the btDbvt for frustum and occlusion culling. See also this related issue.

Cheers,
Erwin
ola
Posts: 169
Joined: Sun Jan 14, 2007 7:56 pm
Location: Norway
Contact:

Re: Questions about btDbvt and frustum/occlusion culling

Post by ola »

Thanks!! :-)
Post Reply