[osg-users] Draw two translucent geometries in specific order

Robert Osfield robert.osfield at gmail.com
Mon May 21 03:28:32 PDT 2018


Hi Kirs,

I'm afraid I'm too busy with other work right now to spend lots of
time reading other various posts on topic, or provide long essays on
here on the topic.

In short:

There is only one default RenderBin in the OSG, that's the main
RenderStage (subclasses from RenderBin).

The StateSet::setRenderBinDetails(BinNumber, "RenderBinPrototypeName")
sets the BinNumber and the "RenderBinPrototypeName" string hints to
the cull traversal what type of bin to create for that BinNumber if
one hasn't yet been created for it.  The strings match up to the list
I posted earlier - this RenderBinProtypeList maps the string to a
RenderBin that is cloned and stored in the rendering backend, and it's
into this bin that the subgraph below that StateSet are dropped into.

RenderBin's can be nested as many times as you want.  A RenderStage is
a RenderBin subclass that is used for high level stages in rendering
such as render to a texture or rendering to the main window, in this
case you have control over the clearing of buffers and any operations
that are done after the rendering.  The front end for controlling
RenderStage is osg::Camera.

Robert.

On 21 May 2018 at 10:34, Kristofer Krus <kristofer.krus at liu.se> wrote:
> Hi again robertosfield, I took a look at the code you posted at this thread (http://forum.openscenegraph.org/viewtopic.php?t=17289), and it gave me some further questions.
>
> According to this code, there seems like there are six default rendering bins, and I don't see that any numbers are associated with them. However, the article (http://www.bricoworks.com/articles/stategraph/stategraph.html) I linked to claims there are two default rendering bins, numbered 0 and 10. Why does that article claim that, if the code seems to imply something very different? Also, why would it say that the numbers used for those bins are 0 and 10? That seems kind of arbitrary to me and doesn't make much sense.
>
>
> robertosfield wrote:
>> subgraphA->getOrCrreateStateSet()->setRenderinBinDetails("RenderBin", 5); // or "DepthSortedBin" if you have mulitple transparent objects that need sorting
>> subgraphB->getOrCrreateStateSet()->setRenderinBinDetails("RenderBin", 6);
>
>
> There is no method called setRenderinBinDetails, but there is a method called setRenderBinDetails. And the order of the arguments for this method is the reversed compared to what you write, i.e. setRenderBinDetails(5, "RenderBin") and setRenderBinDetails(6, "RenderBin").
>
> Also, what do the arguments do? When I use the code you suggested, A is now always rendered after B, i.e. in the wrong order, no matter if I use the numbers 5 and 6 or if I swap them so that I use the numbers 6 and 5. (This seems to be independent of the direction I view the scene from, which is a good thing, though.) I had the impression that render bins with higher numbers would always be rendered later, and that the number we provide as an argument to setRenderBinDetails is the number of the bin we want to put the subgraph in, but this doesn't seem to be the case.
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=73687#73687
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


More information about the osg-users mailing list