What are you doing to ensure that the triangles are rendered in back-to-front 
order?
   -Paul


On 7/3/2012 2:06 PM, Preet wrote:
Hi.

I have a simple model I wanted to apply transparency to. I load the
model data into a geometry node, and set my scene up. To get a
transparent effect, I apply an alpha value to gl_FragColor in my
fragment shader.

The shaders are trivial:
Vertex:
void main()
{
    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}

Fragment:
void main()
{
    gl_FragColor = vec4(1,0,0,0.5);
}

I get a strange output that sort of works, but renders a different
result based on the camera position. It's hard to describe so I
attached a short youtube clip. It seems like certain triangles are
only rendered at certain camera angles.

http://youtu.be/fQUFSff-uuU

I played around with some of the settings I thought might be relevant
but I still get the effect that the video shows.

     osg::StateSet *ss = geodeMesh->getOrCreateStateSet();
     ss->setAttributeAndModes(shProgram,osg::StateAttribute::ON);
     ss->setMode(GL_BLEND,osg::StateAttribute::ON);

       // options i tried changing around
//    ss->setMode(GL_DEPTH_TEST,osg::StateAttribute::ON);
//    ss->setMode(GL_DEPTH_WRITEMASK,osg::StateAttribute::OFF);
//    ss->setMode(GL_CULL_FACE,osg::StateAttribute::OFF);
//    ss->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);

Any advice would be appreciated.
_______________________________________________
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