Hi Deiter,

>From the screenshot It looks to me like you have an depth ordering
issue with transparency.  This is a standard problem with rendering of
any transparent objects in your scene - you basically have to drawn
opaque objects first, then all transparent objects sorted in depth.
In your case you objects are overlapping so you have a problem that
can't easily be tackled by simply putting the objects in the
transparent bin - you'll need to break them up into small parts to get
the depth sorting fine grained enough to fix the ordering.

Robert.

On Wed, Sep 10, 2008 at 9:51 AM, Dieter Pfeffer
<[EMAIL PROTECTED]> wrote:
>
> Hi
> I am trying to fade one modell out and another one in; I am using blendfunc
> and blendcolor.
>
> However the first modell (when alpha is 0) cuts off the second  - see the
> attached images:
>
> a) first modell (dumptruck) cuts off the second
> b) the transparency is corret
>
> I suppose I use a wrong parameter, but I can't find it out - any idea?
>
>
>
> float currentAlpha = 0.0;
>
> void
> setAlphaBlendColor()
> {
>     if (blendFunc0 == 0)
>     {
>         blendFunc0 = new
> osg::BlendFunc(osg::BlendFunc::CONSTANT_ALPHA, 
> osg::BlendFunc::ONE_MINUS_CONSTANT_ALPHA);
>         blendColor0 = new osg::BlendColor (osg::Vec4 (1.,1.,1.,0.));
>
>     if (loadedModel0.valid())  //dumptruck
>     {
>         loadedModel0 ->getOrCreateStateSet()->setAttributeAndModes
> (blendFunc0,osg::StateAttribute::ON);
>         loadedModel0 ->getOrCreateStateSet()->setAttributeAndModes
> (blendColor0,osg::StateAttribute::ON);
>     }
> }
>     if (blendFunc1 == 0)
>     {
>         blendFunc1 = new osg::BlendFunc(osg::BlendFunc::CONSTANT_ALPHA,
> osg::BlendFunc::ONE_MINUS_CONSTANT_ALPHA);
>         blendColor1 = new osg::BlendColor (osg::Vec4 (1.,1.,1.,0.));
>         if (loadedModel1.valid()) //plane
>         {
>             loadedModel1 ->getOrCreateStateSet()->setAttributeAndModes
> (blendFunc1,osg::StateAttribute::ON);
>             loadedModel1 ->getOrCreateStateSet()->setAttributeAndModes
> (blendColor1,osg::StateAttribute::ON);
>         }
>     }
>    if (loadedModel0.valid())
>     {
>         osg::Vec4 l_c;
>         l_c.set(1.,1.,1.,currentAlpha);
>
>         blendColor0->setConstantColor(l_c);
>     }
>     if (loadedModel1.valid())
>     {
>         osg::Vec4 l_c;
>         l_c.set(1.,1.,1.,1-currentAlpha);
>
>         blendColor1->setConstantColor(l_c);
>     }
> }
>
>
>
> Thanks
>
> Dieter
> Unclassified Mail
>
>
> ------------------------------------------------------------------------------------------------------------
> Disclaimer:
>
> If you are not the intended recipient of this email, please notify the
> sender and delete it.
> Any unauthorized copying, disclosure or distribution of this email or its
> attachment(s) is forbidden.
> Thales Nederland BV will not accept liability for any damage caused by this
> email or its attachment(s).
> Thales Nederland BV is seated in Hengelo and is 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

Reply via email to