Hello,

I am learning to use *Transparency Effect* on OpenSceneGraph. I don't know
if I am doing it right. I have made a video screen capture. I do think that
I missed something.... http://www.youtube.com/watch?v=Kzm_1X55OIM

I have multiple shapes. I attached a *osg::Material* attribute to some of
them.The third sphere (nearst to the user) is set to be transparent up to
40%.

// Enable blending, select transparent bin.
> stateSet->setMode( GL_BLEND, osg::StateAttribute::ON );
> stateSet->setRenderingHint( osg::StateSet::TRANSPARENT_BIN );
>
> // Material
> osg::Material * _material = new osg::Material;
> _material->setAlpha( osg::Material::FRONT_AND_BACK, 0.4f );
> _material->setColorMode( osg::Material::AMBIENT );
> stateSet->setAttributeAndModes( _material , osg::StateAttribute::ON );
>
>  // Blending
> osg::ref_ptr<osg::BlendFunc> blendFunc = new osg::BlendFunc;
> blendFunc->setFunction( osg::BlendFunc::SRC_ALPHA ,
> osg::BlendFunc::ONE_MINUS_SRC_ALPHA );
> stateSet->setAttributeAndModes( blendFunc );
>


   1. Have I done it right ??
   2. let suppose I would like to modify the transparency of a Node picked
   ??? Should I get its material attribute and modify its *Alpha* ??
   3. In case, the video show a small lack of transparency between the two
   cylinders and the sphere ?? is it normal ?? or I missed the
*osg::Depth *attribute
   ??

Thank you for advance for your help
Cheers

ps: video http://www.youtube.com/watch?v=Kzm_1X55OIM
*--*
*M. ALJI Mohamed*
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to