# Rotating a Plane around an OBB

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

## Recommended Posts

I want to implement more precise culling in my engine, so instead of using bounding spheres for everything, I want to use their OBB's directly. It seems to me that the easiest way to cull is per plane of the view frustum, is to rotate the plane around the OBB, so that I can treat the OBB as an AABB, and cull to that. I already have a quite plane check for AABBs, so if I can conver the OBB to an AABB, and rotate the plane accordingly, then all is well. The problem is that I can't seem to get this to work right. How would I rotate the plane so that I can handle the OBB as an AABB? My data is the plane equation (normal and distance), the size of my OBB (I store a single size, so that the min is -(size/2) and the max is (size/2) ), and the matrix of my OBB (4x4 matrix for the orientation and position).

##### Share on other sites
You can transform the plane into OBB space, but I think (and this is just speculative - I haven't compared the two methods myself) that it will end up being simply a conceptual alternative to the usual method that will gain you nothing in terms of performance. If you really want to use the AABB function you already have though, there are a couple different ways you could transform the plane into OBB space. Although now that I think about it, it seems you want the position of the box to stay the same, while the plane rotates in such a way that the box becomes axis-aligned, which isn't a complete local-space transformation...

Although I'm sure there's a way to do that, I'm going to punt and just give the 'usual' solution to this problem. The projected radius of an OBB onto a vector v is:
radius = extents[0]*fabs(dot(axis[0],v))+extents[1]*fabs(dot(axis[1],v))+extents[2]*fabs(dot(axis[2],v));
You can use this, along with the projected distance from the box center to the plane, to classify the box with respect to the plane. (It's likely that your AABB-plane test is just a special case of this method.)

##### Share on other sites
The OBB has a center point C, three unit-length and perpendicular axes U0, U1, and U2, and three extents (half the lengths of the sides of the box) e0, e1, and e2. A frustum face has a plane containing a point P and having an inner-pointing unit-lengh normal vector N. The OBB projects to an interval on the normal line P+t*N of the form [d-r,d+r], where d = Dot(N,C-P) and r = e0*|Dot(N,U0)| + e1*|Dot(N,U1)| + e2*|Dot(N,U2)|. The OBB is outside the frustum face if d+r <= 0.

##### Share on other sites
Aha, well there ya go, I really need to work more with OBB's, I use them a bit, but don't really have any thing advanced implemented 'cause I don't understand all the math behind them.

Thanks for the replies to both of you, much better then forcing it into an AABB.

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 12
• 30
• 9
• 16
• 12