Stephen, That example is in the main distro; you need to enable the examples in CMake to see it. The source is here http://www.openscenegraph.org/projects/osg/browser/OpenSceneGraph/trunk/examples/osgvirtualprogram
Yes, yours is a case for shader composition. PrecipitationEffect is self-contained so you would need to modify it to make it work in a composition framework. BTW here is a write-up on the shader composition approach we use in osgEarth. Like I said, we started with VirtualProgram and extended it to support user function injection. http://osgearth.org/wiki/OeDevelShaderComposition Glenn Waldron / Pelican Mapping / @glennwaldron On Tue, Aug 9, 2011 at 10:03 AM, <[email protected]> wrote: > > > Glenn, > Thanks for the response. Do you know where I can find the > osgvirtualprogram example? > The program I have worked on has recently moved from osg 2.2 to 2.8.3 (dark > ages, I know). I do not see osgvirtualprogram in the osg examples > directories for 2.2, 2.8.2, or 2.8.3. > > I am adding precipitation effects (and dust effects) to a project that > currently uses shaders produce a rendered scene that represents sensor > returns - the render target is read back by the main program, > where the data is consumed. For the app/channel that has the sensor, the > program/shader is added to a node near the top of the tree. I have added > the precip effect program/shader to a node slightly below this one - at the > same level as the top terrain and entities node. The sensor shader > basically does range calculation, applies some error, and does some > processing for alpha fragments. For the visual channel, that has no higher > shaders, this works fine. However, for the sensor channel, the precip > particles don't get seen by sensor shader. > > My implementation of rain/snow is based on a slightly modified > osgPrecipitationEffect. Perhaps shader is not the way to go for the precip > effect, but I thought it would provide the best efficiency. Nevertheless, > I can definitely see the need in the near future to have multiple, > accumulated, non-overriding effects. Currently, I would like to be able to > have the results from osgPrecipitationEffect like shader be seen by the > higher sensor shader. > > Any thoughts? > > Stephen Haithcock > General Dynamics Land Systems > 38500 Mound Rd. > Sterling Heights, MI 48310 > MZ 436-40-15 > (586) 825-8573 > > > > > Glenn Waldron > <[email protected] > om> To > Sent by: [email protected] > osg-users-bounces cc > @lists.opensceneg > raph.org Subject > Re: [osg-users] Multiple Shaders > > 08/05/2011 05:35 > PM > > > Please respond to > OpenSceneGraph > Users > <osg-users@lists. > openscenegraph.or > g> > > > > > > > Stephen, > > You need some kind of shader composition. Personally, I prefer the > VirtualProgram approach taken in the osgvirtualprogram example. IIRC, > Robert did not consider this flexible enough to be a general-purpose shader > comp solution, so it's not in the core OSG. However it suited our needs > quite well so we adopted and extended it for use in the osgEarth project. > > > http://github.com/gwaldron/osgearth/blob/master/src/osgEarth/ShaderComposition > > > Glenn Waldron / Pelican Mapping / @glennwaldron > > > On Thu, Aug 4, 2011 at 10:19 AM, Stephen Haith <[email protected]> wrote: > Very timely thread - I am looking at doing the same thing. > > How can you apply a shader effect to the entire scene, AND another effect > to only a part of the tree? > > Thanks, > > Stephen > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=41851#41851 > > > > > > _______________________________________________ > 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 > > > > > > This is an e-mail from General Dynamics Land Systems. It is for the > intended recipient only and may contain confidential and privileged > information. No one else may read, print, store, copy, forward or act in > reliance on it or its attachments. If you are not the intended recipient, > please return this message to the sender and delete the message and any > attachments from your computer. Your cooperation is appreciated. > > _______________________________________________ > 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

