On 04/12/2012 07:34 PM, Preet wrote:
I need to render a bunch of different objects using layer data and I'm
doing it by disabling depth test and specifying a render bin to
control render order... something like

myObject->getOrCreateStateSet()->setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF);
myObject->getOrCreateStateSet()->setRenderBinDetails(11,"RenderBin");

* Should I be doing this on a per-object basis, or would I see better
performance if I created group nodes with the right renderbin setup
and then added the objects to the group nodes (assume hundreds of
objects, but 10-20 layers)? (I don't know how OSG sorts/orders the
scene graph nodes before rendering)

By default, OSG sorts each render bin by state, so your drawables in each bin would be sorted according to the StateSets applied to them such that state changes are minimized. I'm not sure how much of an improvement (if any) you'd see by organizing your drawables into groups and applying the render bin state that way. I doubt it would be all that significant, but I'm not sure.


* Some of my objects have transparency, but again, I'm specifying
render order. So is it okay to put those objects in the "RenderBin"
renderbin as opposed to the "DepthSortedBin"? If Objects A and B are
both transparent, both in "RenderBin" (10) and "RenderBin" (11)
respectively, and A is behind B, I should see object A through B
correct? This is what some preliminary test code seems to indicate
(and in that code switching from "DepthSortedBin" to "RenderBin"
doesn't result in any changes).

If you're disabling the depth test and doing your own sorting anyway, then yes, specifying DepthSortedBin won't do much for you :-)

--"J"

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

Reply via email to