Hi Eldar,

What you are seeing is by using a vertex shader to position the vertex
data you are moving it so the bounding box of the osg::Geometry
becomes inappropriate.  The OSG does it's culling and set up of
near/far planes based on the bounding volume of the nodes and
drawables so if you don't render it within the bounding box of the
geometry there is danger of culling removing the object completely or
the near/far clipping planes clipping the object.

The osg::Geometry class has a setInitialBound(osg::BoundingBox&)
method that enables one to expand the bounding box to handle cases
where you move vertices in a shader.  It's not a ideal API for
handling it and at some point in the future I'll sit down and come up
with a better scheme, but for now it's the tool to use.

Or alternatively just use a osg::Transform node to position your
geometry, this will allow you to share subgraphs and allow the OSG to
keep track of bounding volumes correctly so culling and near/far
clipping will all work correctly.

Robert.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to