Hi,

I'm trying to compute the effect of multiple lights in a deferred shading 
setup. The subgraph of my scenegraph which is supposed to take care of this 
consists of a root node with a number of RTT cameras as children. All cameras 
are configured to write the effect of a single light to the exact same output 
texture.
On the root node I have (tried to) enable blending so the output texture will 
contain a combination of all the lighting that is computed, however, when I run 
the code, it only contains the lighting information of the last child camera 
(i.e. It is overwriting the output texture instead of blending it)

I have set up blending at the root node as follows:

Code:
auto passState=m_pointLightRoot->getOrCreateStateSet();
        passState->setMode(GL_BLEND, osg::StateAttribute::ON | 
osg::StateAttribute::OVERRIDE);
        passState->setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF);
        osg::BlendFunc *blendFunc = new osg::BlendFunc(GL_ONE,GL_ONE);
        osg::BlendEquation *blendEqn = new 
osg::BlendEquation(osg::BlendEquation::Equation::FUNC_ADD);
        passState->setAttributeAndModes(blendFunc,osg::StateAttribute::ON 
|osg::StateAttribute::OVERRIDE);
        passState->setAttributeAndModes(blendEqn,osg::StateAttribute::ON 
|osg::StateAttribute::OVERRIDE);




Is there something wrong with the way I set up blending? Or with my approach of 
having the different cameras as children of the root?

Thank you!

Cheers,
antiro

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





_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to