Page 1 of 1

Collision detection frame coherence at the midphase

Posted: Tue Nov 26, 2013 11:11 pm
by sphet
Hello,

I wonder if anyone has experience with frame coherence within the midphase of the collision detection. We exploit ghost/phantom style queries to help accelerate our triangle queries for a couple of decals that are generated per frame. While the ghost gives us a subset of the broadphase agents, one of the shapes returned is the triangle mesh. This mesh is giant, and spans the scene. We have an acceleration structure (octree or kd-tree) to help partition the space but we still have to do that midphase lookup every frame, even if the overlapping pairs have not changed.

My question is if anyone has experimented with some kind of frame-to-frame caching within midphases, and if so do they have a generalized approach that works well?

S

Re: Collision detection frame coherence at the midphase

Posted: Wed Nov 27, 2013 3:55 am
by Dirk Gregorius
Take the current ghost/phantom AABB if you hit the mesh and inflate it (e.g. either statically or dynamically anticipating the current movement). Use this AABB to query your triangles and cache the indices. In the next frame you first check if your current AABB is inside the inflated AABB you used the frame before. If yes, you hit the cache and you can reuse the triangle indices. Otherwise re-query. How much you need to inflate or if you need to anticipate the movement depends on your use case, but this should be easy to tweak.

Re: Collision detection frame coherence at the midphase

Posted: Wed Nov 27, 2013 3:34 pm
by sphet
Dirk,

Thanks for taking the time to reply. I'll give that a try and see if I can somehow formalize it into a generalization for different agents.

Best,

S