HI Anton,

There a several approaches you can take, none of which will require
modifications to the core OSG classes, so you modifications to CullVisitor
will not be required.

One approach would be to use Geometry::setInitialBound(BoundingBox&) to
expand the bounding box to encompass the range of values that the shaders
may move the vertices too.

Another approach is disable culling via Geometry::setCullingActive(false);

Wr.t bounding volume for the purpose of near/far calculations then you can
disable the computation of near/far values via the
osg::CullSettings::setComputeNearFarrMode(..) method, osg::Camera inherits
from osg::CullSettings so you can apply this mode on the viewers main
Camera.

Robert.


On 22 August 2013 07:59, Anton Fuhrmann <[email protected]> wrote:

> Hi,
>
> concerning the same problem I posted in
> http://forum.openscenegraph.org/viewtopic.php?p=53481 and which is
> referred in http://forum.openscenegraph.org/viewtopic.php?t=4584.
>
> In short (please refer to the above threads for details):
> When you use a vertex shader to move geometry around at render time, the
>  (static) bounding box becomes wrong. In my application I used a shader to
> render a background sky-sphere, so I need the geometry the shader is
> attached to to always render. So I completely switch of culling for the sky
> geometry, but it still gets culled as soon as its original BBox is behind
> the near plane.
>
> I patched CullVisitor.cpp to fix this, but I am not sure if my fix is
> correct and does not break anything else.
>
> Could someone please verify the attached fix?
>
> If necessary, I can supply a demo program which illustrates the bug and
> fix.
>
> Thank you!
>
> Cheers,
> Anton
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=55941#55941
>
>
>
>
> Attachments:
> http://forum.openscenegraph.org//files/noculling_fix_209.zip
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to