Hi Robert,
You'll need to render the scene to a FBO with texture attached to as the depth buffer, then reuse this texture in the second pass.
Just to add specifics to Daniel's question, in case the approach is not right and you can suggest something else.
We want to render something in screen space (from a previous offscreen render pass) onto a screen-aligned quad over the results of the main render pass (the scene), and we know the depth of every given pixel in the previous render pass. The desired effect is that even though the screen-aligned quad is close to the camera, a given pixel should not be rendered if its depth is greater than something else that's already in the frame buffer.
So yes, we could assign the main pass's depth render target to a texture and use that in the post-render pass, but would there be a better way?
Perhaps a better strategy would be to render the screen-aligned quad first, before the rest of the scene, setting the fragment depth to the appropriate value there? Then the main render pass would just do the normal z-buffer test using the value we set before, since we clear neither the color buffer nor the depth buffer between those two passes. Since the screen-aligned quad's contents don't (currently) have transparency, that would work.
Thanks in advance, J-S -- ______________________________________________________ Jean-Sebastien Guay [email protected] http://www.cm-labs.com/ http://whitestar02.webhop.org/ _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

