How, exactly, does frustum culling work in the context of 3D graphics?

109 Views Asked by At

I am currently writing a 3D-rendering program with OpenGl and I need to increase its performance. One of the most promising places to do this is via frustum culling. Fundamentally, frustum culling determines whether or not the volume of an axis-aligned bounding box intersects the volume of a frustum. When I attempt to research the correct math to use this, however, no useful results come up. There are plenty of explanations that are available, but they rely on more mathematical background than I have.

I know single variable calculus, algebra, and 2D non-coordinate-based geometry fairly well. I know very little about linear algebra (just that matrices are two-dimensional arrays of numbers with a strange algorithm to multiply them, and that vectors, when treated as matrices and multiplied with pseudo-magical-to-me matrices then various types of transforms in 3D space happen). This is something that I intend to fix at some point, but not as part of solving this particular problem. Currently, I use the OpenGl Math Library to do a lot of the mathematical heavy lifting in my programs. It can perform the matrix multiplication algorithm (which seems arbitrary to me, to give an idea of how little I know about linear algebra) and can produce the matrices for various transformations, in addition to some other utilities that are specific to OpenGl.

Now that the background is out of the way, I can precisely frame the question that I want to ask:

Given a view frustum defined in 3D space by the horizontal and vertical aspect ratio of the near plane, the distance of the near plane from the camera, the distance of the far plane from the camera, the location of the camera, a vector giving the direction of the camera, and a bounding box that is defined as two opposite coordinates, determine whether or not the volumes of the bounding box and frustum intersect at any point using solely calculus, algebra, 2D non-coordinate-based geometry, and black boxes that are based on linear algebra.

I understand that linear algebra will probably be needed to solve this problem (although a solution without it is ideal). As such, I request that the linear algebra be compartmentalized into a black box where I apply a given formula/function or I can call a particular function in the OpenGl Mathematics Library, as I do not fully understand linear algebra.