   Manually z buffer test
  Hi, I have a mesh and would like to calculate for each vertex if it is visible from a specified view port (point and direction vector). So, my aim is to filter vertices which are visible from the given view port.I read something about "Hierarchical Z buffers" and "adopting of a ray tracing" approach. However, do someone knows a good working approach?! Is it possible to use API's like OpenGL to solve this my problem?Thanks a lot!   
  I assume you want to do this on the GPU?You could draw the vertex as a point on the screen using a hardware occlusion query. These queries tell you the number of pixels that were drawn (i.e. passed the Z-buffer test), so this will tell you if your point is visible or not.   ;  It would be nice to do this on the GPU.But if I render my mesh and use hardware occlusion query's, I only know the count of visible pixels, but not which vertices's are occluded?! Or did I misunderstand it?!   ;  Don't render the mesh, just render the mesh's vertices individually as points. Either the vertex will render 1 pixel or none.   ;  If I render only one vertex of the mesh and not the whole mesh, how should I see if a vertex is occluded by the mesh? I understand, that with this method I can check if a vertex is in the visible area (defined visible area -> near & far plane etc.), but not if e.g. a triangle occludes a vertex which is in the z direction behind this triangle.But perhaps I could render the mesh with the color white and the currently observed vertex with red, If it is easy to count pixels colored with red..?!Thanks again for your help!   ;  Sorry, I thought you wanted to see if vertices from one mesh were hidden by another mesh.Quote:Original post by _FrankieBut perhaps I could render the mesh with the color white and the currently observed vertex with red, If it is easy to count pixels colored with red..?!Yep, that's the idea.You can do this only using the depth buffer instead of a color buffer tho. First render the mesh to the depth buffer as usual, then enable a hardware occlusion query and render one vertex as a single point. The query will tell you if the point was hidden or not (i.e. if it's red or white ;))   ;  Hi againI implemented it for my problem. It works fine, but it is very slow. Perhaps it is not the best solution for my application. I have a mesh with around 20000-100000 points. And I check for each pixel, if it is occluded by any part of the mesh. This means that I have "20000-100000" render passes for my check. It takes a looong time at the moment.However, thanks again for your help!   ;  You could improve the previous algorithm greatly by hierarchically grouping your vertex data and querying bounding volumes from the top down.I can see that if I was using a software rasterizer (for whatever reason), I would do the same as above, but I would read back the z-buffer, generate a hierarchical version of it, and test the vertex cluster bounding volumes against it (which can be done very efficiently).  With graphics hardware, the cost of reading back the z-buffer would probably negate any benefit.If I may ask, why are you interested in the visibile vertices? (as opposed to say visibile triangles)   ;  "If I may ask, why are you interested in the visibile vertices?"I have a mesh and would check for each vertex if it is visible from a defined view point and view direction. I have a rotation and a translation which I apply on my mesh. After this I check which vertex is currently visible. These resulting vertices's are the mesh for a small game. It is more a application for learning :)Could you tell me, where I find some more information about "hierarchically grouping" and "querying bounding volumes"? Because currently I don't know what that means.. Sorry![Edited by - _Frankie on June 5, 2008 10:11:39 PM];  Look up "bounding volume hierarchies" or "axially aligned bounding box hierarchies" for info on how to generate these.  The general idea is that if you have say a thousand vertices within a bounding box, you do one query on the bounding box.  If the bounding box is invisible, you know none of the vertices inside it are visible, so you save 999 queries.  If it is visible, you break the set of vertices into two boxes (say, containing ~500 vertices each), and check each one in the same way.  This way, you only tend to query the visible areas, and quickly reject the invisible areas.   