PDA

View Full Version : Frustum Culling problem (With Octree)



Evil-Dog
05-15-2002, 05:57 AM
Hi guys.
I got a question here.
I'm using octree to do my frustum culling and someday I'll do my collision detection too with it.
for now my octree is almost working.
the only problem is that when I check if the bounding box of an octree is in my frustum, it may return a false result if the bounding box is so large that it's my frustum that is entirely inside the bounding box.
for exemple, in the first subdivision, my bounding boxes width may be like 1000 units, and if I'm standing in the middle of it and if my far viewing distance is like 200, well none of the bounding boxes corners will be in my frustum because the bounding box is too big (so the box is not in the frustum it's the frustum that is in the box you know what I mean ?)

I hope you understand the problem....
My guess is to get, by some way I don't know (that's my question in fact), the 3d position of the 8 frustum corner. (using the position of my camera and the far and near clipping distance and an angle I guess...)
this way, I could do this test (pseudo-code)
if(Box is indide(entirely or partially) the frustum OR frustum is inside the box (entierly or partially)
then render(or go in a deeper octree level.

So i need to know the geometric position of my frustum...All I managed to get with my current knowledge is the distance from the origin for each plane and their normals...

Any one can help ?
thanks a lot !

----------------------------------------
Evil-Dog
*Let's have a funny day*

coredump
05-15-2002, 07:35 AM
All I managed to get with my current knowledge is the distance from the origin for each plane and their normals

isn't this the position of your frustum? distance from the origin?

b

Evil-Dog
05-15-2002, 08:18 AM
Nope

If you go 100 unit along the x axis or the z axis
the distance is 100 unit in both case but the real position isn't given
with the normal and the distance I can know where the clipping planes are I think...but what is the width and height of the near and far clipping plane ? with the width, height of the near and far plane and the normal and distance from origin I could have the 8 corners of my frustum.

width/height(?)
o------------o
\ /
\ /
\ /
o----o
width/height(?)

Beautiful ascii hehe

Anyone can help ? http://www.opengl.org/discussion_boards/ubb/smile.gif

----------------------------------------
Evil-Dog
*Let's have a funny day*

Evil-Dog
05-15-2002, 08:19 AM
woops...my ascii drawing doesn't show right...anyway

you get the problem I need the width, height, normal and distance for the far and near clipping plane I think !
If someone knows how I'd be glad.

------------------------------------------
Evil-Dog
*Let's have a funny day*

AndersO
05-16-2002, 12:11 AM
http://www.markmorley.com/ has a tutorial on frustum culling, it might help. I use it in my frustum-octree culling anyway.

Evil-Dog
05-16-2002, 07:31 AM
Thanks alot AndersO
the link was very very useful
With the sphere test is resolve the problem when the bounding box totally encloses the frustum ! http://www.opengl.org/discussion_boards/ubb/smile.gif

thanks again !

----------------------------------------
Evil-Dog
*Let's have a funny day*