PDA

View Full Version : Vertex visibility



mirage93i
01-20-2004, 12:56 AM
Hi All,
I am drawing a scene with a lot of objects and I need to check visibility of some points. I mean that it should be in view frustum and does not hide by other objects.

Is it possible? And how?

Thank you in advance.

gunslinger
01-20-2004, 05:14 AM
hi mirage!
the answer is yes! every 3d app more complex than a sphere and a torus should be frustum culled. The tough part is that u have to do it by your hands...
try going on www.gametutorials.com (http://www.gametutorials.com)
or
nehe.gamedev.net
and give a look on the tutorial section (the tutorial about octree stuff has a frustum culling example 4 sure). Bye and be an happy camper http://www.opengl.org/discussion_boards/ubb/smile.gif

mirage93i
01-20-2004, 05:18 AM
Hi gunslinger,

Maybe you do not understand me correctly. I need to check not only frustum visibility but hidding the point by other objects and other faces of point object also.

Best regards

zeckensack
01-20-2004, 05:39 AM
OpenGL can do occlusion culling for you automatically.


//init code:
glDepthFunc(GL_LEQUAL);
glEnable(GL_DEPTH_TEST);
Doing this analytically (ie not limited to rendering purposes, infinite resolution) is quite complex, and really not an OpenGL problem.

mirage93i
01-20-2004, 06:06 AM
I hoped that it can be solved by investigation of selection buffer. But I do not know exactly how I should define pick matrix to investigate corresponding object point.

Relic
01-20-2004, 07:45 AM
The selection buffer is not hardware accelerated.
Occlusion culling is not the same as depth testing. http://www.opengl.org/discussion_boards/ubb/rolleyes.gif

There are three occlusion extensions: http://oss.sgi.com/projects/ogl-sample/registry/

ARB and NV variants recommended; the HP one has less concurrency.

Cyranose
01-20-2004, 06:29 PM
Also, since the occlusion query extensions aren't supported on all hardware, the old method which still works for a _small_ number of test points is to do a glReadPixels for the depth value or test for a "key" color on just those 1x1 pixel points you care about.

That sort of thing has been used for the "sun filtering through tree canopy" effect many times (often using a slightly larger area test), but gets too expensive for more than a few light sources.

Avi

mirage93i
01-20-2004, 09:21 PM
Thank you for your replies.
In case of GLReadPixels I should define integer coordinates of window. How I can direct this window to interested point which defined in object space.

ZbuffeR
01-21-2004, 02:37 AM
Originally posted by mirage93i:
In case of GLReadPixels I should define integer coordinates of window. How I can direct this window to interested point which defined in object space.
gluUnProject ?

mirage93i
01-21-2004, 02:43 AM
GluUnproject? Hmmm... Maybe you mean GluProject. Anyway I understand what I should do. Thank you.