Monday, October 24, 2005

Physics Optimizations

OPAL sure provides a lot of features, but I had to utilize it to the outmost to get the size of the simulation that I wanted.

First of all, grouping objects was essential for performance. So, for example a building would be made out of various blocks, which usually stay close to each spatially, so they can be grouped and their collision be optimized, because instead of checking for every block, collision can check their bounding box for the entire group. This is how ODE, physics engine, optimizes collision checks.

Second, OPAL is awesome that it can rebuild objects on the fly from static to non-static type. I used this feature to make sleeping objects static. And static object take the minimum processing power during collision.

With the above optimizations I was able to easily handle scene made out of 2000+ boxes. On the screenshot, you can see the system in action. Note that this is running on NVidia 5200 Go on a laptop, so performace is decent.

The third point is not implemented yet. Its goal is to stabilize some shakiness of the vehicle caused by a dozen of joints, which ODE does handle well at certain configurations. It will dampen small linear and angular acceleration at small values.

1 comment:

pricorde said...

Hi Olex, this is Pricorde from Rigs of Rods.
Thanks for the link, I linked to your blog too. I really appreciate. My physics engine has yet to be "genericized" like yours.

Keep up the good work!