[ODE] Performance patch : not checking collision between disabled bodies

Nguyen Binh ngbinh at glassegg.com
Thu May 27 09:15:17 MST 2004


Hi Adam,

   I couldn't agree with you on the point letting the app handle
   disable bodies:
           1. Disable/enable bodies are built-in term of ODE core so
           ODE should handle it internally. We couldn't say that we
           don't have enough information about disable/enable bodies.
           2. Infact, disable bodies have been handled in the dynamics
           core of ODE : see ProcessIslands(), we just handle enabled
           bodies and bodies connected to enabled bodies so why we
           didn't do that on collision detection?
           3. This collision culling will actually boost ODE
           performance very much.


ADM> The most it saves in the early-escape case versus doing the same
ADM> thing at the start of the callback is a trivial box-disjoint test,
ADM> two geom-AABB tests and a function call overhead.

     Hmmm,for a very large out-door scene with many disabled bodies,
     this overhead will become significant. And overhead is overhead,
     we should avoid it.
     
ADM> The geom-AABB tests are probably the most expensive things there
ADM> when implemented (and conversely probably the least-likely to cause
ADM> an escape short of the full-blown collision test done by nearcallback,
ADM> but I haven't tested that :)) but ODE's policy could be changed to
ADM> make calling AABBTest the responsibility of the nearcallback (this
ADM> doesn't break old code) or skipped entirely (i.e. for sphere-
ADM> sphere collisions where I expect it's a lot cheaper to do a full
ADM> collision test than two sphere-AABB tests, and the app knows better
ADM> than anyone whether sphere-sphere tests are the common case).
     Well, this might be a good idea. :) But have you thought of how
     to incorporate it with QuadSpace and HashSpace?
ADM> Then deciding what to do with disabled-disabled tests become a
ADM> matter of app policy, which I do personally prefer.
     AS I said before, we really should handle disabled-disabled tests
     in the core somehow.
     
ADM> I don't think this patch is correct as it is though.  It assumes
ADM> that both bodies are !=0 but I don't believe that this has to
ADM> be true (otherwise the earliest existing escape of:
if (g1->>body == g2->body && g1->body) return;
ADM> does not totally make sense).

     Hmm, that code is not mine. It's the original. ;0

-- 
Best regards,

---------------------------------------------------------------------
   Nguyen Binh
   Software Engineer
   Glass Egg Digital Media
   
   E.Town Building  
   7th Floor, 364 CongHoa Street
   Tan Binh District,
   HoChiMinh City,
   VietNam,

   Phone : +84 8 8109018
   Fax   : +84 8 8109013

     www.glassegg.com
---------------------------------------------------------------------



More information about the ODE mailing list