I've seen a lot of posts lately regarding multi-pass shading. I think the core osg should probably offer more high level capabilities wrt shaders. I am attaching some code I've made that works for me to do what I call "ModelEffects" (multi-pass shaders on models) and "PostEffects" (multi-pass post-rendering on screen) that work with both Cg and glsl. I am not a good programmer but this might maybe help some people. I tried to include some high-level functionality that I thought would be helpful, for example render scene depth in a 32-bit float buffer or create "PostEffects" with multiple passes of different render target sizes, for example to perform reduction on the GPU (obtain buffer min/max values in final 1x1 texture).
The osgFX / osgNV was a good step in the direction of high-level shader constructs but it did not support glsl and unfortunately the project is on halt. It would also be interesting to see in the future how shaders could be combined in a scene graph hierarchy. I've not worked with the nvidia scene graph but I would be curious to see its multiple shader combination capabilities. Perhaps this is something that we should investigate... I would also take a look at Sh that looks very good on the architecture standpoint and high-level capabilities (http://libsh.org/). regards, bill -----Original Message----- From: [EMAIL PROTECTED] on behalf of Swen Walkowski Sent: Fri 10/12/2007 2:33 AM To: [email protected] Subject: Re: [osg-users] Multipassshading in OSG v1.2 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 <[EMAIL PROTECTED]> 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 [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
<<winmail.dat>>
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

