Intersection test problems

Hello,

I am trying to get our hierarchical BV culling working properly and I'm experiencing some odd behavior with the BoundingFrustum intersection test.

The problem is that when I test my BV's against the frustum the test is not accurate. I am testing spheres and AABB's against the frustum but let's just talk about spheres as I have the same problem with every primitive.

What I have found is that the accuracy depends heavily on the setting I use for the FarPlane when we call Matrix.CreatePerspectiveFieldOfView.

When I set the FarPlane to a big number (like 4700 for example) the camera has to be almost looking in the opposite direction to the sphere in order to get the sphere to fail the test. If I set it to a very small number (like 5) the test starts failing well before the sphere is off the screen.

I have some old code around that does simple point-plane comparisons and that works fine with the same frustum/sphere pairs. In this case we extract the planes from the frustum and manually compare with the other primitive.

I know you use GJK internally so it's different to our old-skool method. What I want to know is if there is any reason why the FarPlane distance would affect the test It's like internally the distance between the near/far plane is being used to construct an angle or something. Honestly I have no idea.

Many thanks

Christian Beaumont



Answer this question

Intersection test problems

  • Uwe Keim

    Hmmm,

    After watching a very long and boring movie then coming back to it I think I might know what is going on.

    My guess is that the current Intersect test for frustum puts a sphere around the frustum and then tests with that instead of the actual frustum. If that were the case then you would see the same effect I am seeing because as the far plane got further away the sphere would get progressively larger.

    Well it's a stab in the dark but maybe this is it. I'll stick with my old-skool solution for now which works just fine.

    -chris


  • Intersection test problems