3d clipping

does anyone know where can i find info to make a clipping function, so in my terrain program i can remove everything that isnt in the 3d pyramid clipping frustum or something?
well i know im rendering in the program things that are behind me and by my sides and even ahead of me that i dont see, i guess with that 3d Pyramid clipping i can remove it all… its something like Frustum clipping… anyone know about it or any better way to clip terrain stuff that isnt in sight?
thanks in advance

If you’re using OpenGL, all polygons will automatically be clipped by the view Frustum. The renderers (sw or hw doesn’t matter) won’t receive anything that’s outside of the frustum

well i guess Opengl and stuff would do it automatically, but still i will have to feed the planes info to opengl right?
using glFrustum() i need to feed the six plane values to it right? or does he makes it by itself? it was it like that i guess there wouldnt exist functions like glFrustum to be used, just some enable/disable variable?
how would u do the 3d frustum clipping under opengl? or 3d clipping ?
thanks in advance

Well, I think that is more a 3d technique question. If I’d write a terrain renderer, I think I’d create an octree represantation of the mesh. You can quickly determine if a box lies in sight, and then mark all visible boxes or put references to them onto a stack or something like that. I think this WILL be faster than to let opengl clip, since T&L cards to frustum culling onboard, so even unused geometry has to be sent over the agp.

Oh, and opengl already defines it’s own frustum planes. Look at gluPerspective. It sets up the planes for a certain fov think. But generally, you don’t have to specify any planes and you will get no errors with pixels outside the the viewport.

[This message has been edited by Michael Steinberg (edited 11-03-2000).]

OpenGL will clip data that is outside the
frustum. However, sending data that won’t
be drawn is inefficient, and leads to lower
frame rates. Thus, you should cull out stuff
that clearly is outside the frustum.

Go to deja.com (or google.com) and search on
“frustum” “culling” and “AABB” (for Axis-
Aligned Bounding Box) and you’ll end up with
hits for explanations on how to do this

Last, if your terrain consists of slabs, you
can probably draw each slab fully even if the
slab only partly intersects the frustum, and
not lose too much performance. This makes
using display lists or on-card vertex buffers
easier, and may end up GAINING you speed.