Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: vertex visibility test

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2004
    Posts
    4

    vertex visibility test

    I'm rendering a triangle mesh using opengl.
    What I want to know is if each vertex on the mesh is visible (that is, not occluded by any triangles of the mesh) at a given viewpoint. Is there any way (fast or slow) to perform this visibility test?
    Any help would be appreciated!

  2. #2
    Intern Contributor
    Join Date
    Sep 2003
    Location
    Jersey, Channel Islands
    Posts
    68

    Re: vertex visibility test

    Do you want to perform this visibility enquiry before or after rendering? This will have an effect on the options available to you. For instance, you may want to know the vertex visibility prior to rendering, in order to speed up this rendering. Just speculating here, not quite sure about efficiency of this pre-render process.

    If you have already rendered your polygons, you have the option to use z-buffering and determine visibility of the vertex. (Z-buffering here means of course depth buffering). Having a test 3d point (the position of your vertex), you project that to screen coordinates. Using glReadPixels, you can get the z value of the drawn primitive at that screen location. Comparing that with the z-value of the test point, you can determine visibility. You'll have to take into acount special cases, like the test point being behing the eye, but that should not be too much of a problem.

    If you haven't rendered your model, hence there is no depth buffer info available (or, simply you don't want to go down that root), the option is to do it the good old fashioned way. Cast a ray from the test point to the eye and see if any intersections with other polygons exist. If not, the point should be visible. You should expect this to be slow, although there are ways to speed it up, which you probably know already (spatial partitioning, boxing, etc.).

    Depending on the exact requirements of your taks, we can talk details or variations on these options.

    mad

  3. #3
    Junior Member Newbie
    Join Date
    Feb 2004
    Posts
    4

    Re: vertex visibility test

    I don't need to know it before rendering.
    Thus, it seems your first solution works.
    But it looks glReadPixel convert(scale) the values in the depth buffer. Can they be compared to the z-value of the test point?
    Thank you for your help.

  4. #4
    Intern Contributor
    Join Date
    Sep 2003
    Location
    Jersey, Channel Islands
    Posts
    68

    Re: vertex visibility test

    Maybe this will help with your last question: http://www.cs.unc.edu/~hoff/techrep/openglz.html

    mad

Posting Permissions

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