[osg-users] Multipassshading in OSG v1.2

Gerrick Bivins biv at iastate.edu
Thu Oct 11 07:05:21 PDT 2007


I think osgFX is where you want to look. That nodekit has some classes
Technique, Effect etc that allow you to define multiple passes. I haven't
used it personally but a developer in our group has used it quite a bit. If
you look at  osgfxbrowser example, I think it has sample code but I'm not
sure if it shows how to do multipass.

On 10/11/07, Swen Walkowski <usedformailinglists at googlemail.com> wrote:
>
> Hello all,
>
> i try to do Multipassshading in OSG v1.2.
> I have written my own shader class in the class I use the osg::shader
> for shading. At the time my shading code looks like that:
> Shader::Shader(void) {
> //creating program
> program = new osg::Program;
>
> //creating shader
> vertShader = new osg::Shader(osg::Shader::VERTEX);
> fragShader = new osg::Shader(osg::Shader::FRAGMENT);
> }
>
> Shader::~Shader(void) {
> }
>
> void Shader::apply(osg::StateSet& state) {
> state.setAttributeAndModes(program, osg::StateAttribute::ON);
>
> vertShader->loadShaderSourceFromFile("shaders/Fixed_Functionality.vert");
> fragShader->loadShaderSourceFromFile("shaders/Fixed_Functionality.frag");
>
> program->addShader(vertShader);
> program->addShader(fragShader);
>
> //parameterize the shader with video texture (0 by default)
> state.addUniform(new osg::Uniform("texture", 0));
>
> posXUniform = new osg::Uniform("posX", (float)0.0);
> posYUniform = new osg::Uniform("posY", (float)0.0);
> intensityUniform = new osg::Uniform("intensity", (float)1.0);
> radiusUniform = new osg::Uniform("radius", (float)0.2);
>
> state.addUniform(posXUniform);
> state.addUniform(posYUniform);
> state.addUniform(intensityUniform);
> state.addUniform(radiusUniform)
> }
>
> That works well.
>
> Now i try to add an secend shading pass. I have read a lot over
> rendering to texture (RTT) in OSG in the mailinglist. So I tryed to
> find the examples or something in the OSG documentation.But without
> luke.
>
> Hope someone can tell me were I find the documentation for
> Multipassshading in OSG or an example or maybe how it works.
>
> Thangs,
> Swen
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20071011/906e3d9c/attachment-0003.htm>


More information about the osg-users mailing list