Hi Marta, hi all,
I think that our problem comes from the fact that the triangles for one
object are not sorted before displaying... ?
This is done between two objects thanks to the
setRenderingHint(osg::StateSet::TRANSPARENT_BIN) but this is obviously
not done for an object himself.
Could someone confirm or undermine my assumption ?
Thank you
Best regards,
Frédéric
Marta Pla i Castells wrote:
Hi Frédéric,
I've been having the same problem with a large scene created and
exported with 3ds Max.
If I tried to change the material of an specific node
osg::StateSet* stateset = geode->getOrCreateStateSet();
osg::Material *material = new osg::Material;
material->setAmbient(osg::Material::FRONT,osg::Vec4(color));
material->setDiffuse(osg::Material::FRONT,osg::Vec4(color));
material->setAlpha(osg::Material::Face::FRONT_AND_BACK,color[3]);
material->setColorMode(osg::Material::AMBIENT_AND_DIFFUSE);
stateset->setAttributeAndModes(material,
osg::StateAttribute::OVERRIDE);
stateset->setMode(GL_BLEND,osg::StateAttribute::ON);
stateset->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
the only result I've been obtained is an opaque geode. The only way
this code works ok is disabling the depth test. I've been working with
this code in version 1.2 and it was ok, but with the 1.9 dev revision,
I have the same problem as you.
Hope someone help us with this because the solution I found was
implementing a shader to change the color of the geode.
Regards
Marta
Frédéric SPEISSER escribió:
Hi all,
My aim : To have the possibility to modulate the level of opacity of
a node in my scene.
While doing that I encountered two problems.
Firstly :
I'm using color indexed surface to define my objects. But if I want
to keep the color information I cannot assign a material to my
object, so I cannot modulate the alpha value of my object... Since I
cannot do that, I'm using a BlendColor and a BlendFunc set to
GL_CONSTANT_ALPHA, GL_ONE, and I change the alpha value in my
BlendColor to have different level of opacity for my object. Is that
the right solution ? Can I do better ?
Secondly :
Blending does not give good results when I'm not disabling GL depth
test... Strange ?! So I must do as following :
node->getStateSet()->setMode(GL_BLEND,StateAttribute::ON);
node->getStateSet()->setRenderingHint(StateSet::TRANSPARENT_BIN);
node->getStateSet()->setMode(GL_DEPTH_TEST,StateAttribute::OFF);
Without saying that it causes incoherency when several objects are in
the scene.
I attached a image resulting of blending without depth test and
another with depth testing.
Someone already encountered this problem ? Have someone a clue ?
I thank you for advance,
Frédéric.
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/