Re: [osg-users] initializing the depth buffer with another camera's buffer before rendering
Hi, I haven't yet figured out how to get from an osg.:Camera or an osg::RenderInfo to an actual fbo pointer. *sigh* Such a method should be usefull, but I didn't find a way to do it neither. In my application, I do something really close, but I affect explicity the texture to use for color buffer and depth buffer : Code: p_sceneCamera-setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT); p_sceneCamera-attach(osg::Camera::COLOR_BUFFER, p_sceneColorOutputBuffer); p_sceneCamera-attach(osg::Camera::DEPTH_BUFFER, p_sceneDepthOutputBuffer) Where p_sceneDepthOutputBuffer : - internalFormat = GL_DEPTH_COMPONENT32 - sourceFormat = GL_DEPTH_COMPONENT - sourceType = GL_FLOAT So I don't need to extract the pointer to the depth buffer, because I already nknow it : it is p_sceneDepthOutputBuffer And then I can share it with another camera or copy it using a renderquad and a shader (but this copy is maybe not as edficient as a glBlitFramebuffer call) Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=52816#52816 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] initializing the depth buffer with another camera's buffer before rendering
Hi, I've been modifying the osgoit code sample to allow opaque objects to occlude the depth peeled layers. I found that rendering the opaque geometry into the depth buffer of each peeled layer causes a lot of overhead because of the extra culling and geometry passes each time. Instead I would like to render my opaque object just once into the first slave camera's depth buffer and copy the contents of its depth buffer into the other slave cameras (or rather FBOs) before performing the depth peeling passes. So instead of clearing the z buffer at the start of each frame, would it be feasible to copy the depth buffer from one FBO into another, and with reasonable performance? Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] initializing the depth buffer with another camera's buffer before rendering
Hello Christian, do you need to copy it? Or is it sufficient to re-use it in terms where it is allowed to be modified by the second pass? If later applies, you simply can bind the same depth buffer as input texture to your RTT pass. Hi, I've been modifying the osgoit code sample to allow opaque objects to occlude the depth peeled layers. I found that rendering the opaque geometry into the depth buffer of each peeled layer causes a lot of overhead because of the extra culling and geometry passes each time. Instead I would like to render my opaque object just once into the first slave camera's depth buffer and copy the contents of its depth buffer into the other slave cameras (or rather FBOs) before performing the depth peeling passes. So instead of clearing the z buffer at the start of each frame, would it be feasible to copy the depth buffer from one FBO into another, and with reasonable performance? Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] initializing the depth buffer with another camera's buffer before rendering
Hi, On Thursday, February 21, 2013 14:13:19 Sebastian Messerschmidt wrote: do you need to copy it? Or is it sufficient to re-use it in terms where it is allowed to be modified by the second pass? If later applies, you simply can bind the same depth buffer as input texture to your RTT pass. That would have been my suggestion too. Since you seem to have shaders this is probably more efficient than blitting the depth buffer into each camera. Greetings Mathias ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] initializing the depth buffer with another camera's buffer before rendering
Hmm, im am stuck trying to extract a pointer to an fbo object in the postDrawCallback of my cameras, allowing me to call fbo_ext-glBlitFramebuffer(...) My offscreen render cameras perform their own FBO setup. I am merely passing the hint to use a frame buffer object as render target by calling setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT); And the only point in the osg source code where an accessor is provided to an osg::FrameBufferObject seems to be in the RenderStage header file. I haven't yet figured out how to get from an osg.:Camera or an osg::RenderInfo to an actual fbo pointer. *sigh* Christian 2013/2/21 Christian Buchner christian.buch...@gmail.com Hi, I've been modifying the osgoit code sample to allow opaque objects to occlude the depth peeled layers. I found that rendering the opaque geometry into the depth buffer of each peeled layer causes a lot of overhead because of the extra culling and geometry passes each time. Instead I would like to render my opaque object just once into the first slave camera's depth buffer and copy the contents of its depth buffer into the other slave cameras (or rather FBOs) before performing the depth peeling passes. So instead of clearing the z buffer at the start of each frame, would it be feasible to copy the depth buffer from one FBO into another, and with reasonable performance? Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org