Hello all,

I just finished a ray-tracing class and have become more familiar with kd-trees. We used a kd-tree to acquire the nearest neighbours for a photon mapping technique. I have read from many places that a kd-tree can be used for frustum culling and am trying to understand how this is done.

Say I use a kd-tree implementation similar to the ANN library (http://www.cs.umd.edu/~mount/ANN/). With such library, you provide it your points and you can query for the N nearest neighbours about a specific point or do a search for the neigbours within a radius at a specific point. The thing is, how is such a structure useful for frustum culling? The KD-tree stores points and can acquire nearest neighbours.... To do frustum culling, wouldn't you have to store AABB bounds with each node of the tree and do some sort of intersection with the frustum while traversing the tree structure? Wouldn't that step away from the purpose of a kd-tree which is to efficiently acquire near neighbors for a given data set of k dimensions?

ANN uses "indices" to a vector of points. So technically, I could somehow store AABB's in another vector with respective indices and pass the center point of each AABB to create the kd-tree. But I still fail to see how that would help.... I'm assuming that the traversal logic would have to be much different than for looking for nearest neighbors.

I'm not sure if the above makes any sense, but in the end, I'd appreciate if someone could point me in the right direction to understand how a kd-tree can help with frustum culling.

Thank you.