[osg-users] How do I access the Z-Buffer content from the last render pass

Daniel Holz danielh at cm-labs.com
Sun Mar 8 18:30:23 PDT 2009

Hi osg-users,

is it possible to access the Z-Buffer content from a render pass 1 in 
the shaders during a second render pass 2 if I do not clear the Z-Buffer 
content in pass 1?

In my project I render my scene in pass 1 and set the clear mask for 
pass 2 to "0", hence not clearing neither the color nor the depth buffer:

Now, how do I read out the Z-Buffer content of the gpu for a given pixel 
in the fragment shader of pass2?
Trying to read from gl_FragDepth did not work.

Any suggestions?


More information about the osg-users mailing list