Sean, RenderBins do have a sort-by-traversal-order option, but it's not accessible by default. But registering a custom bin is actually very easy to implement.
Here's some code for defining a custom traversal-order bin: https://github.com/gwaldron/osgearth/blob/master/src/osgEarthUtil/Controls.cpp#L1966 ..and the code that registers the prototype with OSG: https://github.com/gwaldron/osgearth/blob/master/src/osgEarth/Utils#L132 Then, you just say setRenderBinDetails( binNum, binName) where binName is the name of your custom bin. HTH. Glenn Waldron / Pelican Mapping / @glennwaldron On Mon, Nov 21, 2011 at 10:13 AM, Sean Sullivan <[email protected]>wrote: > Hey guys, > > I'm trying to make a system where I can render part of my scene with two > passes: 1 for stencil mask, the other for stencil test. I have the passes > working by putting things in consecutive renderbins. I set some stencil > stuff in bin 11, then put the mask geometry in bin 12, then some more > stencil related state changes in bin 13, then the final rendered geometry > in bin 14 followed by some default state restoring stuff in bin 15. > > The reason why I do it this way is because of the way the geometry get > added to the scene. I've made an image to help explain it: > [url]http://frongo.net/post_img/scene_bin_structure.jpg[/url] > > Figure 1 shows how the nodes are laid out that should be rendered with > this system. Figure 2 shows how they should be sorted in the bins. > > Basically I need to have them sorted by depth according to the transform > node at LEVEL 2, then drawn in the order that they were added to the LEVEL > 3 group node. I don't want to sort by depth according to LEVEL 4. > > By fiddling with setRenderBinDetails and setNestRenderBins for some reason > I can only get the whole thing to sort by depth, or the whole thing to sort > by traversal. My understanding of the renderbins isn't great especially > where setNestRenderBins comes in. > > Is there some magical combination of bin settings I can set that will make > everything sort properly? Am I doing this completely the wrong way? > > Any help is appreciated! > > Cheers, > Sean > > _______________________________________________ > 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

