It looks like you want to take groups of drawables, sort each group by
traversal order, and then sort those groups by depth. Right? I can't think
of a stock way to make OSG do that in one pass.

A custom render bin might work though. If all your transforms are under a
single custom bin, you can author that bin to sort the underlying drawables
any way you like. In the bin, you have access to each drawable's parents so
you should be able to group them by Transform, sort each Transform group by
traversal order, and sort the list of Transforms by the average depth of
its drawables (or whatever).

Just brainstorming..

Glenn Waldron / Pelican Mapping / @glennwaldron


On Mon, Nov 21, 2011 at 12:19 PM, Sean Sullivan <[email protected]>wrote:

> Ahh, I see what you're saying. Yes you did interpret my drawing correctly.
> I was under the impression that I was creating nested bins by calling
> setRenderBinDetails on the parent transforms.
>
> Would it be possible to create this renderbin hierarchy manually? Or is
> there a better way of doing it?
>
> Sean
>
>
> On Mon, Nov 21, 2011 at 11:27 AM, Glenn Waldron <[email protected]>wrote:
>
>> OK, I didn't know there was already a prototype registered for 
>> TraversalOrderBin.
>> You learn something new every day.
>>
>> Anyway, if I understand your drawing correctly, I would comment that the
>> only put into render bins are Drawables (not transforms). So if you have
>> your Transforms set to a depth-sort bin, but all the drawables set to a
>> traversal-order bin.. there's no depth sorting actually taking place b/c
>> there aren't any drawables in a depth-sort bin. Does that make any sense? I
>> could be wrong.
>>
>> Glenn
>>
>> On Mon, Nov 21, 2011 at 11:05 AM, Sean Sullivan 
>> <[email protected]>wrote:
>>
>>> I should have mentioned that I am actually using TraversalOrderBin and
>>> DepthSortedBin in my code. Maybe I just don't understand how the renderbins
>>> work. Am I correct in assuming that for example the root node would have
>>> several numbered bins, each with the ability to have a depth sorted bin, a
>>> traversal bin, and a state sorted bin inside them?
>>>
>>> It seems that no matter what I do, the last sort order I set in the
>>> hierarchy is the only one that does anything.
>>>
>>>
>>> On Mon, Nov 21, 2011 at 10:44 AM, Glenn Waldron <[email protected]>wrote:
>>>
>>>> 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
>>>>
>>>>
>>>
>>> _______________________________________________
>>> 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
>>
>>
>
> _______________________________________________
> 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