Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collision Detection Performance #11

Open
nithinp7 opened this issue May 2, 2023 · 0 comments
Open

Collision Detection Performance #11

nithinp7 opened this issue May 2, 2023 · 0 comments

Comments

@nithinp7
Copy link
Owner

nithinp7 commented May 2, 2023

By my understanding, Pies should be performance-bottlenecked on the Cholesky refactorization that happens every frame due to collision constraints added / removed from the system matrix - instead we are currently bottlenecked by the performance of collision detection itself. Possible avenues for collision detection performance improvement are described below.

The original acceleration structure we used for the collision system was a parallelized spatial hash, since this was ideal for the particle-contact search we had originally planned to do. We are finding that the performance of the spatial hash in swept-triangle contact culling is highly variable - particularly large, skinny, or fast triangles perform very poorly during spatial hash insertion as well as during spatial hash queries. In those cases, we often have to check many spatial hash grid cells to conservatively cover the swept shape over an interval. Unlike the particle collision case, it is also unclear how to pick a good spatial hash grid size that works for all triangles - as a result the current implementation imposes the burden of choosing reasonably consistent tessellations and choosing a corresponding spatial hash grid size on the user. Since these parameters are hard to tune by hand, I suspect the performance of the typical use case is suboptimal currently. It may be better to implement a BVH based acceleration structure instead, that is more typically seen as a broad-phase for triangle CCD in the literature.

Lastly, in implementing the triangle-triangle CCD, we used a generic root-finding algorithm built into Eigen. We suspect this is not as efficient for our use case, since we should early-exit in the case of imaginary roots or roots outside the t=[0,1] interval. We found the paper “High-Performance Polynomial Root Finding For Graphics”, Cem Yuksel et al., and prototyped a partial implementation of their approach, but did not have time to finish it. We suspect that along with the proper BVH broadphase mentioned above, the specialized Newton-method approach mentioned in the paper would significantly improve our collision detection performance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant