Results 1 to 9 of 9

Thread: Detecting if an object is in the view field

  1. #1

    Detecting if an object is in the view field

    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
    If you save your data in a proprietary format, the owner of the format owns your data.
    <br /><A href="http://msx80.blogspot.com">http://msx80.blogspot.com</A>

  2. #2

    Detecting if an object is in the view field

    you want to use something called frustrum culling

    check out this tutorial (with full source)

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

  3. #3

    Detecting if an object is in the view field

    Quote Originally Posted by tux
    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

    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 save your data in a proprietary format, the owner of the format owns your data.
    <br /><A href="http://msx80.blogspot.com">http://msx80.blogspot.com</A>

  4. #4

    Detecting if an object is in the view field

    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

  5. #5

    Detecting if an object is in the view field

    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.
    There are only 10 types of people in this world; those who understand binary and those who don't.

  6. #6

    Detecting if an object is in the view field

    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 ?
    If you save your data in a proprietary format, the owner of the format owns your data.
    <br /><A href="http://msx80.blogspot.com">http://msx80.blogspot.com</A>

  7. #7

    Detecting if an object is in the view field

    if you give credit to who made the unit i dont see a problem with it

  8. #8

    Detecting if an object is in the view field

    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.

  9. #9

    Detecting if an object is in the view field

    Quote Originally Posted by {MSX}

    Thanks, that's what i need

    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.
    I'm out of my mind but please leave a message
    <br />www.sulaco.co.za
    <br />Rage 3D game engine

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •