Rabbi Robinson wrote:
Hi,
Is there anyway that I can enforce drawing the objects inside first before
drawing the outside membrane?
Sure, just use setRenderBinDetails() to set a render bin for the
membrane that has a higher number than the render bin used by the
interior objects. For the other parameter, you can set either
"DefaultBin" for a state-sorted bin, or "DepthSortedBin" for a
depth-sorted bin.
interiorStateSet->setRenderBinDetails(0, "DefaultBin");
membraneStateSet->setRenderBinDetails(10, "DepthSortedBin");
However, this is equivalent to this code:
interiorStateSet->setRenderingHint(StateSet::OPAQUE_BIN);
membraneStateSet->setRenderingHint(StateSet::TRANSPARENT_BIN);
Which is probably close to what you're already doing. The problem is
that the transparent geometry still has to obey the depth (z-buffer)
test, even if it's drawn last. You can try disabling the depth test,
but this is likely to cause other problems (if you ever have anything
move in front of the membrane, for example):
depth = new Depth();
depth->setFunction(Depth::ALWAYS);
membraneStateSet->setAttributeAndModes(depth, StateAttribute::ON);
This is the main reason why the alpha to coverage method is sometimes
used, even though it's a bit expensive in draw time.
--"J"
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org