[osg-users] transparency becomes dark
u.hertlein at sandbox.de
Fri Jul 25 23:07:40 PDT 2008
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
> 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.
More information about the osg-users