Hello Daniel,

simply set:
    osg::Depth* depth= new osg::Depth(osg::Depth::LEQUAL, 0.0, 1.0, true);
stateset->setAttributeAndModes(depth, osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE);;
to your transparent pass/models

last parameter to depth is depth-writes.
I usually put those things to the camera if the camera is supposed to handle all nodes below the same way. (e.g.. if there is a general shader for the pass)

cheers
Sebastian

Lets put it this way round: my pre-render camera has a depth and a color buffer. My geometry has a vertex and fragment shader that fades the geometry using alpha. I have the desired result in my color buffer but my depth buffer remains empty. How can I force geometry to always write depth, no matter the alpha? Is there a difference in putting the blending and alpha funcs in the geometry stateset or putting it in the camera stateset?

Thanks for help

Daniel



_______________________________________________
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