On Mon, 2010-04-26 at 18:45 -0600, Paul Martz wrote: > Cedric Pinson wrote: > > I am doing a deferred shading and i have a problem to use the depth > > buffer as i would like. Here the order of drawing: > > consider using a scene A > > > > 1 Draw only in the zbuffer > > 2 setup a camera with mtr and draw normal and color into two render > > target. Dont touch to the depth buffer > > - for this step i enable the zbuffer in read only and i dont attach a > > depth buffer to the camera, i want the z to be tested from the viewport > > done on pass 1. It's like the zbuffer is lost between 1 and 2 > > You said you DON'T attach the depth buffer to the camera in step 2? I believe > you need to attach it for the z test. Leave the depth test enabled with the > same > depth function, but set the depth write mask to false. Then it will test > against > the depth buffer.
In fact i thought that pass 1 that write to the frame buffer (depth) would automatically used in pass 2 if i dont attach a buffer to the camera. I tried to attach in pass 2: camera->attach(osg::Camera::BufferComponent(osg::Camera::DEPTH_BUFFER), GL_DEPTH_COMPONENT); Do i need to use a texture for pass1 and reuse it for pass 2 in order it fit ? Thank you for your help Cheers, Cedric -- Provide OpenGL services around OpenSceneGraph and more +33 659 598 614 Cedric Pinson mailto:[email protected] http://www.plopbyte.net
signature.asc
Description: This is a digitally signed message part
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

