1
\$\begingroup\$

Some definitions:

  • An oriented bounding box (OBB) is a rectangular block which can be represented in many ways, as a collection of eight vertices, a collection of six planes or others, for this particular case let's just consider these 2.

  • The camera frustrum is a convex object formed by 6 planes, resulting from converting the unit cube [(-1,-1,-1),(1,1,1)] to world space.

After a lot of researching I've seen you can use the SAT theorem to check collision between convex objects so I assume this could be a choice to check whether my objects will intersect with the camera frustrum.

Right now I've got the OBB of my meshes stored as 8 vertices in world space and my camera frustrum stored either as 8 vertices or 6 planes (also in world space).

So my question, is it SAT suitable to solve this particular problem? If it's so, how would you implement it or where can i find a decently fast implementation of it?

\$\endgroup\$
  • 1
    \$\begingroup\$ Note that there are many shapes that you can represent with 8 vertices that are not OBBs, so working with your bounds in this format might be more complex than using another representation. Let's say we instead store the OBB as a center position, a half-extents vector, and an orientation quaternion. That's 10 parameters instead of 24, and it lets us inverse-transform our plane to reduce a plane-vs-OBB test to a standard plane-vs-axis-aligned-unit-cube (just 4 degrees of freedom left: the plane normal + distance from origin) \$\endgroup\$ – DMGregory Jan 7 at 17:50
  • \$\begingroup\$ Thats interesting ovservation, i assumed by applying an affine world transformation to local space bounding boxes would get OBBs, so thats assumption wasn't correct? And for the same reason the camera frustrum isnt an OBB neither, right? So let me ask first, given a bounding box in local space and a localToWorld transformation, how would i generate OBBs so they will be in the optimal representation to use SAT against the 6 frustrum planes (4d vectors) 🤔? \$\endgroup\$ – BPL Jan 7 at 19:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.