Hi Maxym,

Transparent objects drawing order is important. You have set "
ss->setRenderBinDetails(1, "DepthSortedBin");" so it make your object drawn
first. Try to draw it last with supporting "11" renderbin order instead of
"1".

HTH. Regards.

Ümit Uzun


2010/1/16 Maxym Bilinets <maxymbilin...@gmail.com>

> Hi,
>
> I'm having very first look at OSG. What I need to do is rendering
> transparent STL model.
> I do steps the below:
>
> osg::ref_ptr<osg::Material> matirial = new osg::Material;
>  matirial->setColorMode(osg::Material::AMBIENT);
>  matirial->setAlpha(osg::Material::Face::FRONT, 0.5);
>  matirial->setAmbient(osg::Material::FRONT_AND_BACK, osg::Vec4(1, 1, 1,
> 1));
>  matirial->setSpecular(osg::Material::FRONT_AND_BACK, osg::Vec4(1, 1, 1,
> 1));
>  matirial->setShininess(osg::Material::FRONT_AND_BACK, 64.0f);
>  ss->setAttributeAndModes(matirial.get(), osg::StateAttribute::ON);
>
>  ss->setMode(GL_BLEND, osg::StateAttribute::ON);
>  ss->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
>  ss->setRenderBinDetails(1, "DepthSortedBin");
>
>  osg::CullFace* cull = new osg::CullFace();
>  cull->setMode(osg::CullFace::BACK);
>  ss->setAttributeAndModes(cull, osg::StateAttribute::OFF);
>
> and after all the transparency works but slightly wrong. Seems it uses some
> optimization algorithm, kinda Depth peeling or something else.
>
> But I would like to get "true" transparency with simple tringle sorting. I
> do realise that it might be rather slow but I in my case correctness is more
> important than performance.
> I believe it's possible in OSG since it is claimed in the feature list:
> - Automatic sorting for correct rendering of partially transparent
> geometry.
>
> Can someone help me with that?
>
> Thank you in advance!
> Maxym
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=22754#22754
>
>
>
>
>
> _______________________________________________
> 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