2
\$\begingroup\$

Given a view frustum and a sphere, how do I exactly determine whether or not the sphere intersects the frustum? The typical way of checking a sphere against a frustum finds the signed distance of the sphere center from each frustum plane, but this isn't an exact test and will sometimes fail:

enter image description here

One method is to split the frustum geometry into triangles and test each triangle against the sphere for an intersection but this is slow.

Can SAT be used with a sphere? Are there any other faster methods?

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

If the sphere center lies outside 1 of the planes, check for distance to plane. If it lies outside 2 of the planes, check for distance to the edge they form. If it lies outside three of the planes, check for distance to their shared intersection point.

If it's actually a sphere in pretransformed world space, you can intersect against the pretransformed rectangular prism and it's pretty easy. If you're really intersecting a sphere against a truncated pyramid frustum, then there's a little more math to work out, and some edge/corner cases (ha) to do with lying outside 3 faces that don't form a corner.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .