Even within the transparent bin you can enforce specific ordering with the bin number. Lower numbers get rendered before higher numbers.

I'd have to dig to find any of my own example code but I hoped perhaps the hint would be enough in short time.

We did this all the time to render double-side transparent geometry. Draw the inner faces in a lower bin number than the outer faces. Even with different bin numbers you can still depth sort them.

We had semi-transparent glass boxes with text on the sides. I think we ultimately had three different bin numbers we used for that associated with the inner, outer, and text geometries.

-Paul

Jason Daly wrote:
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

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to