Hi Mateo,

I don't have time to look at your attachment (I have many support
posts to get through) so can't answer specifics.

If you are having problems with the contents of your textures when you
use the textures check to make sure the the RTT Camera that is
rendering to the texture is run before the subgraphs that use it. Use
the Camera::setRenderOrder(..) method to do this.  The render to
texture examples all use this so have a look at them for guidance.

Robert.

On 6 March 2014 08:46, Mateo Gasparovic <[email protected]> wrote:
> 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
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to