Hello Andrea,

It sounds like you have two distinct problems.
The first is to render to texture and to use the texture as input for your second pass. This is easy, take a look at the osgPreRender example. Basically you render fullscreen to a FrameBufferObject and use the bound texture in a second pass as input to your fragment shader.

Your second problem is to bind different states to the same nodes. This can be done in different ways. First option is to clone you graph, bind your second program and render set it to your second-pass camera.


Another option is to bind the shaders at camera level, which depending on your rendering model is the easiest way.

If you need to render the first pass with different shaders at different nodes, but only one shader for all nodes at your second pass, you can also simply bind it to the root/camera of your second pass and set it to override.

Since you're talking about refraction: If you need refractive objects like glass which refract the scene, you will need to make a copy of the first pass result framebuffer (without refractive objects) and bind it as input to your second pass to get the background distorted correctly. But beware, this won't work nicely with other transparent objects.

cheers
Sebastian




Hi,
i'm wondering if is it possible to apply different shaders (vertex and 
fragment) on the same osg::Node (not entire scene as RTT image) in this way : 
The result (ouput) of the first vertex/fragment shader must be used as input of 
the second vertex/fragment shader. In example, i have used a vertex and 
fragment to get refraction effect. But, unless i write the proper 
vertex/fragment code in this refraction shader, i loose lights setting coming 
from osg code. I would like to set lights using a shader (vertex/fragment) on 
the osg::Node already affected by refraction shader.
Is there any example that show how to get it?

Thank you!

Cheers,
Andrea

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=53516#53516





_______________________________________________
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