View Full Version : vertex visibility test
02-24-2004, 06:36 AM
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!
02-24-2004, 08:54 AM
I think you can render it twice right after clearing the depth-buffer. Set stencil-op to inc on depth-fail. If you get any values > 0 in the stencil buffer you have some kind of overdraw, so some part of your mesh is obscured .
[Edit] Didn't read that you wanted to test for the vertices only. You could do the second render in GL_POINT-mode. You might need to use polygon-offset though since the rasterizer can create slightly different depth-values for pixels rasterized with GL_POINTS instead of GL_TRIANGLES.
[This message has been edited by jeickmann (edited 02-24-2004).]
02-24-2004, 11:18 AM
Thanks. For it to make work, I think I need to know the 2D position of each vertex in the stencil buffer. Otherwise, I should read the whole stencil buffer after rendering each vertex (using glReadPixels which is very slow). Any suggenstion?
02-24-2004, 01:26 PM
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.