Jean-Sébastien Guay wrote:
osg::ref_ptr<osg::Material> material=new osg::Material;
material->setAlpha(osg::Material::face::FRONT_AND_BACK,0.5);
statSet->setAttribute(material.get());
Note that setAlpha might not do what you want - it sets the alpha of
ambient, diffuse, specular and emission colors. I think you'd probably
just want to set the alpha of the diffuse color, something like
osg::Vec4 diffuse = material->getDiffuse(osg::Material::FRONT_AND_BACK);
diffuse.a() = 0.5;
material->setDiffuse(osg::Material::FRONT_AND_BACK, diffuse);
If you just set the diffuse alpha, then the alpha will be zero on the
dark side of objects, won't it? (I've been doing shader lighting for so
long, I've forgotten how FFP lighting works...) Probably should set the
ambient or emissive alpha to 0.5, and be sure to set all other alpha
values to 0.0.
(Doing this with lighting really complicates things. I'd use BlendColor,
personally, and set the blending equation to reference it.)
-Paul
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org