Hi, If you can get by with rendering only first layer of transparency, or rendering all layers without respect to ordering (f.e. when all layers have low alpha values and/or close color values): for 1st case - you can draw your model first only to depth buffer, then 2nd time only to color buffer with depth test set to EQUAL for 2nd - you draw you model first only to color buffer, then only to depth buffer
Cheers, Sergey. 04.07.2012, 00:06, "Preet" <[email protected]>: > 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

