Ultimately I am trying to generate an image where each pixel represents the distance from the viewer to the content in the pixel. I guess you could think of it as something like an imaging range finder.
Wyatt On 6/10/09, Robert Osfield <robert.osfi...@gmail.com> wrote: > HI Wyatt, > > On Tue, Jun 9, 2009 at 11:07 PM, Wyatt Earp<wyattbsearp1...@gmail.com> > wrote: >> Let me see if I understand this... Assuming I pass no args to the app when >> I >> run it, the osgdistortion createDistortionSubgraph first creates a camera >> which will render the scene to a texture attached to an FBO before the >> main >> camera renders the scene. Then the "hud" camera is created to render the >> quad textured with the texture created by the previous camera? So I have >> two slave cameras in addition to the main camera? > > Yes two slave cameras, and a master camera that is passive - it just > provides the projection and view matrix for the first of the slaves to > use for it's projection and modelview matrix, the second camera has > ignores the master projection and modelview matrix, the two slaves > achieve this be setting their ReferenceFrame to RELATIVE_RF (the > default) and ABSOLTE_RF respectively. The slave Camera's also set > their RenderOrder to make sure the RTT camera is draw first. > >> How would I render scene to a depth texture? Do I create a depth texture >> and attach it to the first camera? > > You just attach the texture you want to the Camera's depth buffer > component rather than the colour buffer component. > >> Assuming that I want to use the texture created by the first camera as an >> input to frag shader program, would I need to add a third camera which I >> would add the shader as is done in the osgshaders example? > > If you want another pass then you might use another camera, but if you > just do everything in a second pass using the original texture then > the will be no need to do add another slave camera. You really don't > provide enough info on what exactly you are trying to achieve and why > so I can't really say too much on what you actually need in your case. > > Robert. > _______________________________________________ > 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