Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: hello ! Question about Culling !

  1. #1
    Junior Member Newbie
    Join Date
    May 2001
    Posts
    21

    hello ! Question about Culling !

    I wonder me if when I have an object who are hidden by an another, OpenGl draw it then delete it ?
    Must I create a Culling Function to know if an object must be drawed with glvertex ...
    The FPS can be better ?

    Thanks !
    I hope that you'll understand my bad english !!
    Cyril

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Mar 2001
    Posts
    2,704

    Re: hello ! Question about Culling !

    The only functions that determine "visibility" in OpenGL are Z buffer, stencil test, alpha test and back-face culling. (did I miss some?)

    Because you just submit simple geometry serially to OpenGL, it cannot determine whether some polygon you're submitting now might be obscured by some polygon you'll be submitting later -- the work-around is to use the Z buffer, although you will eat up some of your available fill rate.

    As you say, you can do some kind of occlusion/culling (portal engines seem well matched to modern hardware for indoors scenes) to avoid doing unnecessary work on the card.

    Now, you're saying you're using glVertex(). If you want your stuff to run fast, the first thing you should do is move over to glVertexPointer() and glDraw{Range}Elements(), possibly using either the NV_vertex_array_range or EXT_compiled_vertex_array extensions.
    "If you can't afford to do something right,
    you'd better make sure you can afford to do it wrong!"

  3. #3
    Junior Member Newbie
    Join Date
    May 2001
    Posts
    21

    Re: hello ! Question about Culling !

    Thanks for your informations !

    I tried to use GlDrawElements, but that had not run faster !!! why ? i don't know !
    So i use Lists with some called at glVertex3f(...);

    So, OpenGL make calculs for all call to glVertex ? if an object is behind you, (in a 3d engine) openGL 'll make caculs for this object as if it won't be showed on the screen ?

    Thanks
    Cyril

    Originally posted by jwatte:
    The only functions that determine "visibility" in OpenGL are Z buffer, stencil test, alpha test and back-face culling. (did I miss some?)

    Because you just submit simple geometry serially to OpenGL, it cannot determine whether some polygon you're submitting now might be obscured by some polygon you'll be submitting later -- the work-around is to use the Z buffer, although you will eat up some of your available fill rate.

    As you say, you can do some kind of occlusion/culling (portal engines seem well matched to modern hardware for indoors scenes) to avoid doing unnecessary work on the card.

    Now, you're saying you're using glVertex(). If you want your stuff to run fast, the first thing you should do is move over to glVertexPointer() and glDraw{Range}Elements(), possibly using either the NV_vertex_array_range or EXT_compiled_vertex_array extensions.

  4. #4
    Member Regular Contributor
    Join Date
    Apr 2001
    Location
    Greece
    Posts
    496

    Re: hello ! Question about Culling !

    If you don't want do draw any objects that you cannot see because they're behind you or generally not where you're looking what you need is to implement view-frustum culling.Do a search on the web.You'll find info on how to do that.Also don't forget the opengl FAQ .There's som usefull info there too.
    If you don't want to draw onjects that *are* in your view-frustum(the area the camera can 'see')but are hidden by other objects(which are in front of them) then what you need is occlusion-culling.I have never tried this but I think you'll be able to find enough info on the web.
    Hope that helps.

    [This message has been edited by zen (edited 06-03-2001).]

  5. #5
    Junior Member Newbie
    Join Date
    May 2001
    Posts
    21

    Re: hello ! Question about Culling !

    Thanks you !!!
    I'll search !
    bye
    Cyril

  6. #6
    Junior Member Newbie
    Join Date
    Jun 2001
    Posts
    9

    Re: hello ! Question about Culling !

    I have the best results creating my own culling algorithm and applying it to the data first so only visible vertices are passed to be drawn.

    I find that it is always useful to transform from object coords to world coords and store the world coords (useful for collision detection). It may help to use simple model for clipping and collision detection and use the information for the more complex model. Perform culling algorithm when all objects are in place and viewing volume clipping can be performed.

    combine the view and projection matrices and invert. This gives a volume in world coords. Compare stored world coords of objects with world coords of clipping volume to test if visible.

    I prefer to not use zbuffer if possible and use a fast depth sort of objects instead. When rasterizing zbuffer comparisions are SLOW even in hardware. It may not look as nice but is faster.

  7. #7
    Senior Member OpenGL Pro
    Join Date
    Feb 2001
    Location
    Switzerland
    Posts
    1,840

    Re: hello ! Question about Culling !

    how do you do the sort of the triangles? you need the nearestpoint on triangle.. how do you get this fast?
    http://davepermen.net - if i could stay true to my heart, i would feel totally free

  8. #8
    Advanced Member Frequent Contributor
    Join Date
    Oct 2000
    Location
    Belgium
    Posts
    857

    Re: hello ! Question about Culling !

    Originally posted by stim:
    I prefer to not use zbuffer if possible and use a fast depth sort of objects instead. When rasterizing zbuffer comparisions are SLOW even in hardware. It may not look as nice but is faster.
    I seriously doubt that. Are you saying that disabling the depth test and doing a depth sort of all your triangles for every frame is faster than letting the hardware take care of things?

    If you're going to sort by depth, do it in a way that will actually do you some good: enable the depth test and sort your (opaque) geometry front-to-back. Also, do the sorting per object rather than per triangle. Your CPU has better things to do with its time

    - Tom

  9. #9
    Junior Member Newbie
    Join Date
    May 2001
    Posts
    21

    Re: hello ! Question about Culling !

    do you have some links about culling, mathematics for culling and others ... ?
    Thanks !
    bye
    Cyril

  10. #10
    Member Regular Contributor
    Join Date
    Feb 2001
    Location
    Montréal, QC, Canada
    Posts
    345

    Re: hello ! Question about Culling !

    flipcode.com

Posting Permissions

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