7
\$\begingroup\$

The rigid body physics engines that use a "bounding box" for collision detection, I am aware of how they are created.

What I want to know is, is there a physics engine that does not use "bounding box" but actually uses something like vertex data to do the physics calculations? What type of physics engine is this called, and does it use the GPU?

\$\endgroup\$
1
  • 2
    \$\begingroup\$ Most physics engines I know support at least convex and often also concave meshes, not just bounding boxes. At least PhysX can utilize GPU for calculations. \$\endgroup\$
    – msell
    Commented Mar 19, 2013 at 8:11

2 Answers 2

5
\$\begingroup\$

There are two general cases for using a physics system in a game:

  1. For gameplay. That is, using forces and collisions to move objects around. The physics system manages the location and movement of game objects.

  2. For visualization, things like particle systems. These are pure-rendering things that don't affect gameplay.

Handling #1 on the GPU is a bad idea performance-wise. The problem is that you need to do a CPU->GPU->CPU round-trip. The CPU needs to manage where objects are, so that AI and other systems can manipulate it. Therefore, the CPU may need to update the position of objects. The CPU also needs to read the positions of objects, as well as be notified of any collisions. So you can't just fire off some GPU "rendering" commands and then do something else; you need that information right now for AI and the like.

This forces a GPU/CPU synchronization. A GPU/CPU sync is one of the worst things you can do for performance. You want the GPU to operate as asynchronously as possible. Doing physics of type #1 on the GPU works against that.

Now, for #2 physics, things are different. In this case, the physics is completely subservient to the rendering of the object. It basically does physics solely to do rendering. Therefore, everything can effectively live on the GPU. For this, doing the physics on the GPU makes sense, because the AI and game engine don't care about any collisions or whathaveyou.

I don't know of anything complex enough for people to call it a "physics engine" that doesn't handle at least convex hulls. You can generally build concave meshes by taking many convex hulls and using constraints to effectively fuse them together, though how well this works depends on the physics system.

Many physics engines do have some way to run on GPUs. PhysX and Bullet have some mechanisms for it, though it may be limited to certain hardware that provides appropriate support.

\$\endgroup\$
1
\$\begingroup\$

In general bounding boxes are used as quick checks to avoid performing the more expensive collision checks involving the complete geometry. If the bounding boxes of two objects do not intersect then it is guaranteed that the objects themselves do not intersect, and therefore the real collision detection between these objects can be skipped.

No serious physics engine use bounding boxes for actual collision checks, if they are used it is purely a performance optimization that has no influence on the outcome of the simulation.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .