[osg-users] Retrieving occlusion query results prior to swap(was: RE: Need a post-swap traversal)

Robert Osfield robert.osfield at gmail.com
Tue Oct 23 01:37:19 PDT 2007

On 10/22/07, Paul Martz <pmartz at skew-matrix.com> wrote:
> Hm. I really want all the occlusion queries to be done after all other
> "normal" rendering has finished (to maximize the chance for occlusion to
> occur). So it seems I really want a POST RenderStage that issues the
> queries, then iterates looking for available results; as each result becomes
> available, it checks for visibility and renders or skips the actual
> Drawables accordingly.

What is there left to draw if you've drawn everything?  The sequence
for drawing within one frame has to be:

  1) draw the best occluders (ones with large shadow volume when
projected into clip space)

  2) draw the the query geometries

  3) get the results and dispatch the full geometries associated with the
      query geometries.

 > Also, I don't want to limit this to Drawable-level queries. It is very
> useful to be able to perform a single occlusion query to test for the
> visibility of an entire subtree. Thoughts on that?

Indeed useful, but hard to implement without doing within the cull
traversal, and this would stall the graphics the graphics pipeline big

The fudge would be to collect the query geometries during the cull
traversal and associated this geometry with all the drawables
undernearth it in the scene graph.  Then during the draw traversal
have the render leaves check their associated query geometry result.
This wouldn't save of cull, but would at least save of draw

Now if the camera isn't moving, and the occluders aren't moving then
you could possible introduce some frame coherency and do cull at the
query point in the scene graph.

Perhaps a new node could be introduced into the OSG to help out with
the decoration of subgraphs that you want to test the query for.


More information about the osg-users mailing list