[osg-users] Strange culling of Drawables in OSG 3.5.1?

Robert Osfield robert.osfield at gmail.com
Wed Jan 27 01:57:56 PST 2016


Hi Anton,

On 27 January 2016 at 09:27, Anton Semenov <allcreater at gmail.com> wrote:
> after migration from OSG 3.2.0 to 3.5.1 we have discovered a bit unexpected behaviour of Geodes, which property setCullingActive was setted to "false". Suppose, we have a Geode with some linked Drawables. Now all Drawables is trying to make cull tests independently of parent's setCullingActive state.
>
> I'm not sure is it a bug or feature, but the code in CullVisitor.cpp, void CullVisitor::apply(osg::Drawable& drawable) method looks questionably:
>
>
> Code:
> if (!getNodePath().empty() && getNodePath().back()->isCullingActive() && isCulled(bb)) return;
>
>
>
> Could you please confirm, is that expected behaviour or it was planned that isCullingActive property should be asked from parent node, not current drawable (im apply method getNodePath().back() is already equal to drawable)?
>

I haven't yet reviewed the CullVisitor.cpp code but looking at the
code above it looks like there is code hasn't been updated to reflect
the refactor of osg::Drawable so that is subclasses from osg::Node.
Now that Drawable subclasses from Node it inherits the
Node::s.getCullingActive() flag is should check it's own flag now
rather than it's parent as it would have done before.

The code above looks like it's write to check that Drawable parent to
whether it should check for culling or not, but probably isn't doing
that now as the NodePath managed by the NodeVisitor will include the
node being visited so the back will actually be the Drawable rather
than the Geode parent.

Whether the CullVisitor should enforce the old behaviour is not is an
open question - doing so would make the behaviour inconsistent to how
all other Nodes are handled i.e. the Node's own CullingActive flag
affects it and it's parents, but not it's children.  The old
Geode/Drawable CullingActive behaviour instead affected all parents
and children of the Geode.

FYI, 3.4.x will also behave like 3.5.1 as the Drawable changes were
made prior to 3.4.0.

Robert.



More information about the osg-users mailing list