[osg-users] Multipassshading in OSG v1.2

Swen Walkowski usedformailinglists at googlemail.com
Thu Oct 11 23:33:58 PDT 2007


Hello all,

thanks for the answers! I have tried a look to the osgFX and to the
source code (thanks Christian).

One question I have. See I that right that I can just use Multipass
sading at the time in OSG. I have to write my own solution like what
you have posted Christian, or do the inflexibility way?
I think about it, because I have to use it in my diploma thesis and at
the time we don't know in wisch way we have to use the shading. So
maybe it is good to do an onw solution.

Christian, from your expiriance how long you meen it takes to get
thinks with an own solution running?

Thanks a lot,
Swen

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
>



More information about the osg-users mailing list