Hello Ahmed, > I need to draw a sphere inside a Transparent one. > Can anyone tell me how to set the material and color of the Transparent one. >
If you're using ShapeDrawables for your spheres, you can do it like this: // Sphere of radius 1, red and semi-transparent. osg::ref_ptr<osg::ShapeDrawable> sphere = new osg::ShapeDrawable(new osg::Sphere(osg::Vec3(0,0,0), 1)); sphere->setColor(1, 0, 0, 0.5); // red, with 50% opacity. sphere->getOrCreateStateSet()->setMode(GL_BLEND, osg::StateAttribute::ON); // Activate blending. osg::ref_ptr<osg::Geode> geode = new osg::Geode; geode->addDrawable(sphere.get()); // Sphere of radius 0.5, blue. osg::ref_ptr<osg::ShapeDrawable> sphere2 = new osg::ShapeDrawable(new osg::Sphere(osg::Vec3(0,0,0), 0.5)); sphere2->setColor(0, 0, 1, 1); // blue osg::ref_ptr<osg::Geode> geode2 = new osg::Geode; geode2->addDrawable(sphere2.get()); osg::ref_ptr<osg::Group> root = new osg::Group; root->addChild(geode.get()); root->addChild(geode2.get()); That should give you a semi-transparent red sphere with an opaque blue sphere inside. (untested...) If you're using normal geometry, you need to set a color array with the opacity you want, and remember to enable blending on it too. J-S -- ______________________________________________________ Jean-Sebastien Guay [EMAIL PROTECTED] http://www.cm-labs.com/ http://whitestar02.webhop.org/ _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org