Original Post
Whenever I read about frustrum culling, its always done using bounding boxes. I'm wondering if it could be done more efficiently using bounding spheres for objects to be tested and a bounding cone for the view frustrum. I know about using a sphere encompassing the view frustum to eliminate objects. I'm wondering if this approach might be faster than using the sphere and then the bounding box, or if it could be used in conjunction with either/both of those methods.
Using a cone would not be 100% accurate, since monitors aren't circles; some objects along the edges would be kept when they hould be discarded (particularly around the midpoints of each side). Maybe using a second cone bounding the inside of the view frustrum (intersecting the midpoints of the sides, rather than the corners of the actual bounding box) could be used to identify objects around the border that could be tested using a bounding box. Testing the objects against 2 2D triangles (one for the horizontal and one for the vertical) might work better, though this would mean more comparisons.
I'm just trying to think of new ways to do frustrum culling that might be faster. Testing each point of one bounding box against 6 planes seems like a lot of comparisons.
I wish I could draw out all of the geometry, it would help explain this a lot better. Here is what I've worked out so far to test if a sphere is within a cone. This doesn't take the radius of the sphere into account, but it should be easy enough to add that.
Variables -
deltaX, deltaY, and deltaZ are the coordinates of the object in relation to the viewer
viewerXZ is the horizontal rotation of the viewer
viewerYZ is the vertical rotation of the viewer
objectXZ is the horizontal rotation of the object in relation to the viewer
objectYZ is the vertical rotation of the object in relation to the viewer
minDepth and maxDepth are the limits of the view frustrum
viewAngle is the angle of the cone
Steps -
1. evaluate deltaX, deltaY, and deltaZ
deltaX = objectX - viewerX
(same for Y and Z)
2. check against minDepth and maxDepth
deltaX^2 + deltaY^2 + deltaZ^2 < maxDepth^2
(same for minDepth)
3. evaluate objectXZ and objectYZ
objectXZ = InverseTan(deltaX / deltaZ) - viewerXZ
(same for YZ)
4. check if the object is in the cone (think of a circle given by the equation x + y = viewAngle^2, where x represents the XZ angle and y represents the YZ angle. test to see if the XZ and YZ angles for the object are within this circle)
objectXZ^2 + objectYZ^2 < viewAngle^2
Using a lookup table for the InverseTan function would lose accuracy but increase speed tremendously. As it stands now, this method would only require three comparisons for each object (2 depth tests and 1 for the cone).
Please post any thoughts/comments.
[edited by - M16hty M0u53 on August 1, 2002 3:43:39 PM]