Question

I've made a basic .obj mesh loader that can load models and texture them in OpenGL. However, my question is what would be the best solution to then put bounding boxes on them. For example if I a load a model which is a circle, would putting an AABB around it be a terrible solution?

My idea is to make an object have a global AABB box then the model also has a list of more perfect bounding boxes.

My question is, what should I use to make this list of more perfected bounding boxes?

Was it helpful?

Solution

Don't worry about "more perfect bounding boxes" for your collision detection. That is not the point of them. What you want is a bounding element - and possibly a hierarchy of them - which allows you to easily test for intersections and reject large sets of polygons/elements on which you don't need to perform your elementary intersection tests.

I would say, start out with your AABBs (or even bounding spheres, for the simplicity of them). And either top down, or bottom up (using some appropriate heuristic) construct a tree out of them. Your top node has your large AABB which fits your entire model. And each branch (with its AABB) contains an ever smaller subset of your mesh. You want the final tree to be well balanced.

Should you notice that your AABBs cause problems (as in, not enough performance perhaps), then you can always select other bounding elements. OBBs or k-DOPs perhaps. In our garment simulation code for example k-DOPs have shown to be a good fit.

In any case, you might want to look up the book "Real-time collision detection". It goes into this topic in depth and is IMHO an excellent resource if you're interested in a topic like this. But just keep things simple at first. Make them work, then worry about optimization.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top