PDA

View Full Version : Frustum Culling



Imaging
03-27-2006, 09:27 AM
Hi, I'm just implementing frustrum culling in one of my programs and I believe its working correctly I was just wondering if anyone had any methods that could test this correctly.
Thanks in advance

Komat
03-27-2006, 10:56 AM
You can modify modelview matrix you send to card so you see scene from diferent point with culling using the original position and orientation. The GLIntercept tool can do this for you if you use standard modelview matrix stack.

Ehsan Kamrani
03-27-2006, 11:08 AM
I have no idea about the function glFrustum(). However giving the argument of the function gluPerspective(), we can find the width and height of the near and far planes.
If we use from the following function:
gluPerspective(fov, ratio, nearDist, farDist);
Then the height and width of the near plane are:
Hnear = 2 * tan(fov / 2) * nearDist
Wnear = Hnear * ratio
And the width and height of the far plane are:
Hfar = 2 * tan(fov / 2) * farDist
Wfar = Hfar * ratio

These values-Hnear, Hfar, Wnear, Wfar, nearDist and farDist - make a frustum and you can test if your objects are within the frustum.
-Ehsan-

jide
03-27-2006, 11:10 AM
I guess this is not what he expected :) He certainly made what you told. He just wanted to test if he has done it correctly.

But to my opinion this is out of GL...

Imaging
03-27-2006, 11:37 AM
Yes I have the frustrum created and then test to see if the objects are in that space, its just then testing to ensure culling is taking place..Thanks anyway

Tin Whisker
03-28-2006, 10:00 AM
I've found that giving my frustum a slight "pinch" in the FOV relative to the actual OpenGL view pyramid helps me to visualize things a bit. This way I can see objects being culled before they actually leave the visible frustum. You know, just as a sanity check.