Archived

This topic is now archived and is closed to further replies.

AA bounding boxes

This topic is 5501 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m using a tight-fitting axis-aligned bounding box on my objects in my 3D engine. However, whenever an object rotates, the bounding box does not envelope the object anymore due to the way the axis shift during rotation. How are most people around here handling this? Should I make the bounding box much looser so that it has the same axis length equal to the longest axis length? In such a case, if I had an object whose origin is 0,0,0 and it extents upward 100 units, then my bounding box would have to be centered at 0,0,0 as well and it''s axis length equal to 200 to accomodate the rotations right? Thanks in advance for anyones input/advice.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
i switched to OBB for objects that i had to transform every frame. it seemed to take as much time to shrink/expand the AABB as it did to transform the boxes verts. i never did performance test it though.

Share this post


Link to post
Share on other sites
You should test how critical a good fitting bounding box is for your specific application. If it is very important, you should consider using an OBB. As the AP said, transforming the OBB is pretty fast (naive code uses 8 vector/matrix multiplies, optimized code uses 4). The drawback of OBBs is that intersection tests (frustum, collision, etc) are slower than AABBs. It can also be problematic, if your bounding box is part of a hierarchy. So in short, for what exactly do you need your bounding boxes ?

Share this post


Link to post
Share on other sites
...naive code uses 8 vector/matrix multiplies, optimized code uses 4...

How? And also any papers on optimizing OBB/Ftustum test would also be welcome.

You should never let your fears become the boundaries of your dreams.

Share this post


Link to post
Share on other sites
quote:

...naive code uses 8 vector/matrix multiplies, optimized code uses 4...

How?


Well, 8 is straightforward, just rotate all 8 OBB vertices. Alternatively, you can just rotate a single reference point, and 3 vectors defining the (non-normalized) local coordsys of the OBB. If needed, the remaining OBB vertices can then be computed by vector addition. You could also do it with 3 transforms and a crossproduct, but then you'll lose then length information of the 3rd coordsys coordinate, so in effect that would (probably) be slower (Edit: perhaps not, if you use 3DNow/SSE). Other alternative would be to extract the OBBs coordsys frome it's local matrix. That would require some matrix concatenations, so it might not be as efficient as the vector rotation method.

Papers... hmm, I must have some, but it's been a while I haven't done any OBB stuff anymore. If nobody else posts something, I'll check my bookmarks and post some links.

/ Yann

[edited by - Yann L on November 21, 2002 4:55:18 PM]

Share this post


Link to post
Share on other sites
Well, I eventually will probably want to do a lot with the bounding boxes. Right now I''m using them for object picking in a large world editor that I''m making. But I will want to use them for my collision routines and whatnot so I may want to do hierarchial boxes.

ALso, how are you generating your OOBs? It seems to me that it''s much harder to generate them for an arbitrary set. Right now if I switch to an OOB, I would just calculate a tight fitting AABB and use that but I''m sure there are better ways.

Also, how are you storing your OOBs? Is it by 8 vertices?

Share this post


Link to post
Share on other sites
quote:

ALso, how are you generating your OOBs? It seems to me that it's much harder to generate them for an arbitrary set.


Yeah, it's a little harder. Typically, you try to find the dominant axis of the object, and construct from there. There are various methods to do that, I'll check for a paper I have in mind, it presented a very fast method using convex hulls.

quote:

Also, how are you storing your OOBs? Is it by 8 vertices?


You could, but better is either by their local coordinate system matrix and a few scalars, or by a reference vertex and 3 coordsys vectors.



[edited by - Yann L on November 21, 2002 4:59:51 PM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
take a look at Eberly''s work: http://www.magic-software.com/Intersection3D.html

he has some pretty good pdfs written on using OBBs re: frustrum intersection and collision detection.

Share this post


Link to post
Share on other sites
Hey thanks everyone. I''ve started to convert over to the OOB stuff. Gotta rewrite a lot of stuff (like intersections and that crap). But I''m sure it''ll work out fine. The beauty of all of it is that I can still use AABBs and just compute them from the OOB so all isn''t really lost.

Share this post


Link to post
Share on other sites