Hello,
When I try to add transparency to a loaded model, the original color of the model is lost. In some cases, the color stays and gets darker (and semi-transparent), but in other it just disappears and turns grey (and semi-transparent). I am sure I am doing something wrong, but it happens even with the simplest code. For example: osgViewer::Viewer viewer; osg::ref_ptr<osg::Node> model = osgDB::readNodeFile("cow.osgt"); osg::ref_ptr<osg::StateSet> ss = model->getOrCreateStateSet(); osg::ref_ptr<osg::Material> blendMaterial = new osg::Material; blendMaterial->setAlpha(osg::Material::FRONT_AND_BACK, 1); ss->setAttributeAndModes( blendMaterial.get() , osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE); osg::ref_ptr<osg::BlendFunc> bf = new osg::BlendFunc(osg::BlendFunc::SRC_ALPHA, osg::BlendFunc::ONE_MINUS_SRC_ALPHA ); ss->setAttributeAndModes(bf); viewer.setSceneData( model.get() ); return viewer.run(); It happens even if I set the alpha value to 1, which if I understand it correctly, should leave the model as it is (with no semi-transparency). The attached image shows a comparison of the model without applying the material and the model after applying the material with alpha=1. It, of course, also happens if I set alpha to less than 1. Could someone give me some hint on what I am doing wrong? Thank you in advance. Best regards
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org