Hi! Based on the Cookbook example of the RTT camera I've been able to show Depth map of one object (complete code: 01depthMapVizual.cpp and result: 01depthMapVizual.PNG).
root->addChild( pass0_color.first ); root->addChild( pass0_depth.first ); root->addChild( hudCamera.get() ); ... viewer.setSceneData( root.get() ); A problem occurs when I try to send Depth map to Shader. osg::StateSet* stateset = new osg::StateSet; stateset->setTextureAttributeAndModes( 0, pass0_color.second ); stateset->setTextureAttributeAndModes( 2, pass0_depth.second ); Than some kind of random patterns occur. (complete code: 02depthMapTryToVizualizeWhitSheader.cpp and result: 02depthMapTryToVizualizeWhitSheader_firstCompile.PNG, *_secondCompile.PNG) You can see how I've tried everything I could remember in fragment Shader but still can visualize depth map. I would like to: 1) visualize Depth Map with Shader 2) Texture a real photo on a way that the texture is shown only on the first obstacle. (I plan to do so with Depth map, similar to your example). 3) Project multiple photos with different perspectives on the same object. To stars, I was wondering how to make a depth map with the same perspective as projective map for one photo (texture) and how to visualize it with shader. Please if you could give me some pointers. Thanks, Mateo ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=58486#58486 Attachments: http://forum.openscenegraph.org//files/depthmap_182.rar _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

