PDA

View Full Version : Detecting if an object is in the view field



{MSX}
08-11-2004, 07:05 AM
Hi! I'd like to have a way to detect if a body is visible on the screen or not (ie if it is behind the camera, or far too distant from it).
I have the body as a mesh, from wich i can eventually get the bounding box.
I have the camera position and the LookAt point (as in gluLookAt).

What algorithm can i use? It doesn't matter if it's not 100% precise.
If you have something premade and ready to use, all the best :P

tux
08-11-2004, 11:28 AM
you want to use something called frustrum culling

check out this tutorial (with full source)

http://www.delphigl.de/tutorials/frustumcull.html

{MSX}
08-11-2004, 01:45 PM
you want to use something called frustrum culling

check out this tutorial (with full source)

http://www.delphigl.de/tutorials/frustumcull.html

Thanks, that's what i need :P

I've a question: the article says that the only advantage is that you avoid passing the model to the gxfcard. Is that all there ? If i use display list, than there's no passing of model data (at most 1 integer), so i'll not get any advantage. Is that wrong ?
Is it better to do the frustum culling in software or let the card to that in hardware ?

Thanks

tux
08-11-2004, 03:03 PM
i think display lists are still stored in the main ram so youll still be passing it.

vertect buffer objects are stored in the vram, take a look at this

http://www.delphigl.de/files/GL_ARB_VBO.zip

Clootie
08-11-2004, 03:34 PM
Frustum clipping for current GPU's should be done on per-object level (and object probably should contain 100's of triangles). So this will avoid 100x T&L cost on video card.

{MSX}
08-11-2004, 06:03 PM
Ok, i enabled the frustum culling with that beautiful unit with almost no changes.
Do you think i can include it in an open source project ?

tux
08-11-2004, 06:16 PM
if you give credit to who made the unit i dont see a problem with it :)

Paulius
15-11-2004, 11:51 AM
A bit of a correction, while OpenGl specification does not force display lists to be stored server side there would be no sense keeping it client side on modern cards. And to explain what clootie said, while clipping is done in hardware it works with polygons which all will still need to be transformed before that and besides sphere in frustum check is so cheap that you should at least implement that before asking you?_Tre graphics card to render high polygon meshes.

McCLaw
04-05-2005, 01:08 PM
Thanks, that's what i need :P

I've a question: the article says that the only advantage is that you avoid passing the model to the gxfcard. Is that all there ? If i use display list, than there's no passing of model data (at most 1 integer), so i'll not get any advantage. Is that wrong ?
Is it better to do the frustum culling in software or let the card to that in hardware ?

Thanks

If you combine the frustrum code with an octree or AABB tree for your terrain/non moving meshes, you have a very powerfull way of culling away large parts of the scene at Low CPU cost.