Art Tevs wrote:
Hi Juan,

there is no problem, it is a normal behaviour.
What you can try is to enable backface culling, then the artefacts should 
disappear.
Just an addition to the above. This works as long as the transparent object consists of a fully closed shape (which is the case here). If it weren't you'd introduce new artifacts by culling transparent faces that should be visible.

Paul
This behvaiour comes from rendering of triangles no in the correct order. Osg 
doesn't provide triangle sorting on transparent objects as far as I know. Only 
per object sorting is supported.

Cheers,
Art


--- Juan Casanueva <[EMAIL PROTECTED]> schrieb am Di, 17.6.2008:

Von: Juan Casanueva <[EMAIL PROTECTED]>
Betreff: [osg-users] Artefacts in transparent objects
An: [email protected]
Datum: Dienstag, 17. Juni 2008, 13:24
Hi there,

I am having some problems with transparent objects. They
have some artefacts
(slices) depending on the view point.
To illustrate the problem, I have done a simple example
that draws a
transparent red sphere with a box inside it.
I have attached screenshots showing the strange
"slices" appearing in the
sphere.
I must be missing something. any help would be
appreaciated.

Here is the code:

#include <osg/Geode>
#include <osg/ShapeDrawable>
#include <osg/Material>
#include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers>

int main( int argc, char **argv )
{ osgViewer::Viewer viewer; viewer.addEventHandler(new osgViewer::StatsHandler); viewer.addEventHandler(new osgViewer::WindowSizeHandler); osg::Group *root = new osg::Group; // transparent sphere
  osg::Geode  *sphereGeode = new osg::Geode;
  sphereGeode->addDrawable(new osg::ShapeDrawable(new
osg::Sphere(osg::Vec3(0.0f,0.0f,0.0f),40.0f)));
  osg::StateSet* pStateSet =
sphereGeode->getOrCreateStateSet();
  pStateSet->setMode(GL_BLEND,osg::StateAttribute::ON);
pStateSet->setRenderingHint(osg::StateSet::TRANSPARENT_BIN); osg::Material *pMat = new osg::Material; pMat->setDiffuse(osg::Material::FRONT_AND_BACK,
osg::Vec4(1, 0, 0, 0.5));
  pMat->setAlpha(osg::Material::FRONT_AND_BACK, 0.5);
sphereGeode->getOrCreateStateSet()->setAttributeAndModes(pMat,
osg::StateAttribute::ON);
root->addChild(sphereGeode); // box inside sphere
  osg::Geode *boxGeode = new osg::Geode;
  boxGeode->addDrawable(new osg::ShapeDrawable(new
osg::Box(osg::Vec3(0.0f,0.0f,10.0f),10.0f)));
  root->addChild(boxGeode);

  viewer.setSceneData( root );

  return viewer.run();
}



Thanks
Juan_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


      __________________________________________________________
Gesendet von Yahoo! Mail.
Dem pfiffigeren Posteingang.
http://de.overview.mail.yahoo.com
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to