[osg-users] Culling with custom clip planes

Robert Osfield robert.osfield at gmail.com
Mon Oct 26 03:21:11 PDT 2015


Hi Jannik,

Just catching up with this thread, but am afraid my brain isn't yet clear
enough this Monday morning to be able spot anything.  I'm afraid I'm still
a bit foggy brained, did a 38 mile, hilly and muddy ultramarathon at the
weekend :-)

For now I don't have anything else to add to your experiments.  If you are
still struggling after your latest experiments I'll just to my head around
the issue later.

Robert.

On 24 October 2015 at 22:50, Jannik Heller <scrawl at baseoftrash.de> wrote:

> Ok, setting on projectionCullingStack works fine for the whole subgraph,
> you just have to transform the plane to view space first:
>
>
> Code:
>
>     virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
>     {
>         osgUtil::CullVisitor* cv = dynamic_cast<osgUtil::CullVisitor*>(nv);
>         if (cv)
>         {
>             osg::CullingSet& cullingStack =
> cv->getProjectionCullingStack().back();
>
>             osg::Polytope::PlaneList origPlaneList =
> cullingStack.getFrustum().getPlaneList();
>
>             osg::Plane transformed = mCullPlane;
>             transformed.transform(cv->getCurrentCamera()->getViewMatrix());
>
>             cullingStack.getFrustum().add(transformed);
>
>             traverse(node, nv);
>
>             // undo
>             cullingStack.getFrustum().set(origPlaneList);
>         }
>         else
>             traverse(node, nv);
>     }
>
>
>
> It's a bit ugly, but good enough for me. Unless Robert has a better idea,
> I'll stick with this approach!
>
> Cheers,
> Jannik[/code]
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=65434#65434
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20151026/594423ad/attachment-0003.htm>


More information about the osg-users mailing list