Advertisement

When implementing SAT for boxes, are Guass Maps needed for optimization or will they just slow things down?

Started by April 03, 2024 04:25 AM
2 comments, last by fractali 8 months, 2 weeks ago

From my understanding, when we implement SAT with contact manifold creation for just boxes, we don't need to do the entire Hull vs Hull code outlined in Dirk's presentations [1] [2].

I was originally implementing this method, but then I read a few other physics engines and it seems for boxes than one can just do 15 overlap checks (one for each axis), and then clip the faces for manifold creation. Am I missing something, or is my assumption correct that for boxes, the SAT method outlined in [2] for hulls would be less optimal.

[1] https://media.steampowered.com/apps/valve/2015/DirkGregorius_Contacts.pdf

[2]https://ubm-twvideo01.s3.amazonaws.com/o1/vault/gdc2013/slides/822403Gregorius_Dirk_TheSeparatingAxisTest.pdf

It depends. Principally a specialized box SAT could potentially be faster. There might be some extra work to figure out which edges are actually realizing the contact point, but it can all be implemented efficiently in SIMD.

In practice I cache the last separating axis and rebuild the contact from there if I can. The is referred to as utilizing temporal coherence (s. Gino's book). I don't recall if I talk about this in my talks. Basically the witness features will not change much between frames. So the whole contact generation boils down to testing one separating axis and then clipping. The clipping needs to happen anyways. So in S2 we therefore don't have any box shapes. The performance gain is neglectable (if any) and I largely favor the simplified collision matrix over slight theoretical performance gains. But this depends on the implementation. If you just look at the complexity without this the specialized SAT might be faster.

Hope that helps!

Advertisement

Thanks Dirk, this definitely helps, I appreciate it. My problem is I get too hung up on the most optimal way to do things. Your contact manifold talk made a lot of sense to me for the hull vs hull case, so I was curious if this was done in practice for boxes.

Thanks again!

This topic is closed to new replies.

Advertisement