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?

  • 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 '19 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 '19 at 19:23
  • \$\begingroup\$ I don't know if you have found solution or not, but SAT is the way to go if you have convex geometry of any kind. Frustum is a convex shape and OBB is a convex shape. Given that you have OBB stored as 8 vertices, I suggest you to store OBB as a half-extents vector and 3x3 rotation matrix (which is essentially three coordinate basis vectors). This way you will already have all necessary projection directions needed for SAT by simply using column(or row) vectors of the OBB matrix. And you can use frustum the way it is right now. \$\endgroup\$ – Ocelot Sep 2 '19 at 0:52

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.