Depth sorting parent nodes?

11 views
Skip to first unread message

Rob Spearman

unread,
May 23, 2021, 5:57:03 PM5/23/21
to OpenSceneGraph Users
I have a collection of complex objects that need to be depth sorted for proper transparency rendering. 

However, each object itself is a small scene graph that has to be rendered in a defined order, so a depth sorted TRANSPARENT_BIN breaks the correct object rendering.

What I want to do is have the collection of objects (children of a single Group node) rendered back to front based on their bounding box distances to the eye.  Each child would render as it needs to.

Is there any way to accomplish this other than putting each object in it's own renderbin and updating these each frame?

Thanks,
Rob

Robert Osfield

unread,
May 23, 2021, 6:01:29 PM5/23/21
to OpenSceneGraph Users
Hi Rob,

For custom sorting within bins you'll need to implement your own RenderBin subclass and register a name for it, then use this name in the scene graphs StateSet::setRenderBinDetails(name, number).

I can't remember the details since it's a number of years since I implemented anything like this.  Have a look at the include/osgUtil/RenderBin header, and search through the OSG examples for setRenderBinDetails as this might provide some clues.

Robert.
Reply all
Reply to author
Forward
0 new messages