OGL sets up a default material , you may be picking this up -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dieter Pfeffer Sent: Wednesday, July 30, 2008 8:09 AM To: OpenSceneGraph Users Subject: Re: [osg-users] transparency becomes dark
Thanks Ulrich and Dimi I supposed that it has s.th to do with the missing material paramters; my idea was to change the original material of the node, therefore I set: osg::StateSet *ss = loadedModel ->getOrCreateStateSet(); osg::Material* blendMaterial = (osg::Material*)(ss->getAttribute(osg::StateAttribute::MATERIAL)); but the material is always NULL so I don't have the original material Is this the wrong function call ? Dieter Unclassified Mail -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Ulrich Hertlein Sent: Saturday, 26 July, 2008 08:08 To: OpenSceneGraph Users Subject: Re: [osg-users] transparency becomes dark Hi Dieter, Dieter Pfeffer wrote: > I am trying to set the object transparency from 1.0 -> 0.0 and vice > versa; but when I start changing the alpha of the material the object > becomes dark. > > I have changed the material parameters but without success; when I > look in the loaded model (for example cow.osg) for material, the > material is always null. > > I have modified the osgviewer example and attached it. > > Could s.o. give me a hint what I am doing wrong ? You're creating a new Material that overrides the material of the node you're fading. However, you're not setting the Material properties (ambient, diffuse, specular, emissive, shininess) and the default values for Material are unlikely to match that of the node you're trying to blend. Hence when you override the original material it will switch from the original settings to the default Material. For an experiment, have a look at any .osg file and look at the material properties. Then set those values on the 'blendMaterial' node you're creating and it should look smooth. You're probably better off modifying the original Material(s) of the node hierarchy. Or try another approach, like using blendcolor. Cheers, /ulrich _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org Disclaimer: This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender and delete this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. Considering the inherent risks of the use of e-mail communication, Thales Nederland BV shall not be liable for any damage derived from it. Thales Nederland BV is seated in Hengelo (Ov.), the Netherlands, and registered at the Chamber of Commerce under number 06061578. _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org