Hi Oliver,

One approach would be to use a dot product operation in a vertex shader that
tests vertex coordinates of candidate objects against the current view
frustrum for scene view A.  If the angle between the gaze vector (centre of
view frustrum) and a vector created from the eyepoint to the candidate
vertex is less than the angle subtended by the view frustrum, then the
object is being "looked at" (i.e., it is located within the frustrum.
Because the view frustrum is trapezoidal in nature, this won't be a perfect
test, but it will be quick.  A set of slightly more complicated operations
could be performed in the vertex shader to achieve a more accurate result.

Alternatively, you could use callbacks associated with culling, but that
would be far less efficient for a large number of objects.

I'm pretty sure I've seen a few threads on this topic on the mailing list
over the last year or two.  You may want to have a quick search through the
archives.

Cheers,

Murray

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Oliver Schoenborn
Sent: June 21, 2007 5:06 PM
To: osg users
Subject: [osg-users] fast "is-visible" test

I would like to change the color of a geode in one scene view (call it 
B) based on how "often" a geode is visible in another scene view (call 
it A). I.e., the longer the geode is being "looked at" in A, the 
brighter its corresponding geode gets in B, up to some saturation value. 
If I only had a small number of such geodes I could use IntersectVisitor 
but I have a large number of them (about 1 million), so I'm looking for 
better ways.

I suppose a fragment shader might work, if two conditions are met:

   1. Textures (as 2D arrays) can be written to by one shader, and read
      from by another
   2. A shader only gets called for a fragment if fragment is visible --
      not occluded by anything else.

Any easier way? Any comments on above greatly appreciated.
Oliver

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to