Frustum Culling Problem (With Bounding Spheres)

Hello,
I have a sphere that acts as a quadtree. Each quad on the sphere has a bounding sphere associated with it. These bounding spheres appear as follows:

Based on this rendering I know that each sphere is in it’s correct position on the planetary quadtree.
Yet for some reason when I use the following code to detect if the sphere is in or is being intersected by the frustum of the camera, the quad is not always culled:

[java]
public boolean inFrustum(QuadMesh q){
mainClass.getCamera().update();
FrustumIntersect s = mainClass.getCamera().contains(q.sphere);
if(s.equals(FrustumIntersect.Inside) || s.equals(FrustumIntersect.Intersects)){
return true;
}else{
return false;
}

}

[/java]

The following code does the actual culling:

[java]
if(MainClass.checkFrustum){
if(!inFrustum(q, 0) && q.inFrustum){
q.inFrustum = false;
detachChildren(q); //recursive method to remove leaf nodes from scene
}else if(inFrustum(q, 0) && !q.inFrustum){
q.inFrustum = true;
attachChildren(q); //recursive method to add leaf nodes to scene
}

		    	} 

[/java]

With this I get strange results:

some of the quads behind the camera are left un-culled and some far to the left and right are un-culled. Sometimes even less quads are removed from the scene.

I am note sure where to go from here…
Thanks for any and all help!

Just to make sure the problem was not with the frustum I rendered this image (frustum in yellow):

Notice the quads outside of the frustum still in existence

Where are you getting the spheres that you are rendering? They look quite a bit smaller than what a bounding sphere would be.

Perhaps put together a simple test case that will illustrate the issue. When that works fine then you can figure out what is different about your setup that makes it fail. In the rare case that the simple test case also fails then we’ll be able to more easily show you what is wrong.

@pspeed said: Where are you getting the spheres that you are rendering? They look quite a bit smaller than what a bounding sphere would be.

Perhaps put together a simple test case that will illustrate the issue. When that works fine then you can figure out what is different about your setup that makes it fail. In the rare case that the simple test case also fails then we’ll be able to more easily show you what is wrong.

I make the spheres by setting their centers to the quad centers and setting their radii to half of the approximate arc-length of the quads they correspond to.

Ok, I will keep working on it. I just wanted to make sure there were no problems with the way I check for an intersection/volume being in frustum…
Thanks.

@okelly4408 said: I make the spheres by setting their centers to the quad centers and setting their radii to half of the approximate arc-length of the quads they correspond to.

Ok, I will keep working on it. I just wanted to make sure there were no problems with the way I check for an intersection/volume being in frustum…
Thanks.

Well, just keep in mind that depending on how you created the spheres, their bounding shapes may be quite a big larger than the actual ‘mesh’. For example, a JME Sphere mesh looks like it just uses the standard mesh bounds code… which means it’s actually a bounding box that contains all of the sphere points. Culling is done with the bounding shapes.

@pspeed said: Well, just keep in mind that depending on how you created the spheres, their bounding shapes may be quite a big larger than the actual 'mesh'. For example, a JME Sphere mesh looks like it just uses the standard mesh bounds code... which means it's actually a bounding box that contains all of the sphere points. Culling is done with the bounding shapes.
Ah, OK. The spheres that I am testing against the frustum are actual bounding sphere.

I was thinking the same as pspeed that maybe it was actually axis-aligned bounding boxes but even so, it is weird that it isn’t symmetrical.