Hi If you need to blend all visible layers - try to change order of passes, and set colormask to all false's (so first will be only color, second only depth). If you dont need depth from transparent geometry - you can get by with only first pass. If you need only closest single layer - you draw first pass depth only (with colormask set to false's), second pass with depth test set to lequal.
Cheers. 09.10.2012, 09:33, "Tina Guo" <[email protected]>: > Hi, > > In open inventor, there is a transparency mode called: delayed blend > > Transparent objects are rendered using multiplicative alpha blending, in a > second rendering pass with depth buffer updates disabled. And I want to get > the same effect. > > here's what I am trying to do > > transparency->setRenderingHint(osg::StateSet::TRANSPARENT_BIN); > transparency->setAttributeAndModes(new osg::BlendFunc(GL_SRC_ALPHA > ,GL_ONE_MINUS_SRC_ALPHA), osg::StateAttribute::ON); > _geom_solid->setStateSet(transparency); > > class TransparencyTechnique : public osgFX::Technique > { > public: > TransparencyTechnique() : osgFX::Technique() {} > virtual bool validate( osg::State& ss ) const { return true; } > > protected: > virtual void define_passes() > { > osg::ref_ptr<osg::StateSet> ss = new osg::StateSet; > ss->setAttributeAndModes( new osg::ColorMask(true, true, true, true) > ); > addPass( ss.get() ); > > ss = new osg::StateSet; > osg::Depth* depth = new osg::Depth; > depth->setWriteMask( false ); > ss->setAttributeAndModes( depth, osg::StateAttribute::ON ); > addPass( ss.get() ); > } > }; > > The result is not right. how should define_passes() be defined? > > ... > > Thank you! > > Cheers, > Tina > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=50484#50484 > > _______________________________________________ > 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

