[osg-users] Rendering in traversal order - how?

199 views
Skip to first unread message

Glenn Waldron

unread,
Oct 30, 2015, 5:40:48 PM10/30/15
to OpenSceneGraph Users
Been scratching my head on this one for a while...

I have a node created by a plugin. I need the contents of this node to be rendered in traversal order. How do I do it?

Naturally, I tried to use a TraversalOrderBin... setRenderBinDetails(0, "TraversalOrderBin"). However, this will only activate my new render bin if the *current* RenderBin has a different bin number. If the current bin is already #0, it will put my geometry in that existing bin and ignore my request for a TraversalOrderBin.

Tried an OVERRIDE; tried disabling nesting; even tried overriding traverse() and tricking the CullVisitor into creating a new bin for me. No luck.

So...how do I force traversal-order rendering for this node?

Glenn

Robert Osfield

unread,
Oct 31, 2015, 7:26:58 AM10/31/15
to OpenSceneGraph Users
Hi Glenn,

On 30 October 2015 at 21:40, Glenn Waldron <gwal...@gmail.com> wrote:

Been scratching my head on this one for a while...

I have a node created by a plugin. I need the contents of this node to be rendered in traversal order. How do I do it?

Naturally, I tried to use a TraversalOrderBin... setRenderBinDetails(0, "TraversalOrderBin"). However, this will only activate my new render bin if the *current* RenderBin has a different bin number. If the current bin is already #0, it will put my geometry in that existing bin and ignore my request for a TraversalOrderBin.

A single RenderBin's can't have two types of rendering order at the same time. 

 
Tried an OVERRIDE; tried disabling nesting; even tried overriding traverse() and tricking the CullVisitor into creating a new bin for me. No luck.

So...how do I force traversal-order rendering for this node?

The simplest way is to Use a different RenderBin number so the OSG's rendering back-end creates a bin for it.

Robert.
 

Glenn Waldron

unread,
Oct 31, 2015, 8:32:15 AM10/31/15
to OpenSceneGraph Users
Robert, I get that, but since the node is created by a plugin, how do I pick a RenderBin number that is guaranteed to be different? That is my dilemma.

Glenn

Robert Osfield

unread,
Oct 31, 2015, 8:43:38 AM10/31/15
to OpenSceneGraph Users
Hi Glenn,

On 31 October 2015 at 12:32, Glenn Waldron <gwal...@gmail.com> wrote:
Robert, I get that, but since the node is created by a plugin, how do I pick a RenderBin number that is guaranteed to be different? That is my dilemma.

There isn't a way of forcing this without getting your hands dirty with the rendering backend.

If you post process the loaded scene graph you'd be able to take account of what already been loaded in the application.

Robert.

 

Glenn Waldron

unread,
Oct 31, 2015, 9:17:22 AM10/31/15
to OpenSceneGraph Users
OK that confirms what I thought. Thanks.

I got my hands dirty and came up with a solution that appears to work, pending lots of testing of course. Code is here if you are curious: http://pastebin.com/zyme9vL1

Glenn

Reply all
Reply to author
Forward
0 new messages