Hi Timm,
I ran into a similar problem to what you have and solved it without having
to modify the OSG Core source code. The problem is that osgViewer does not
do eventTraversal and updateTraversal on the slave's subgraph regardless if
they are using the mastersSceneData or not. I'm submitting a fix to this on
osg-submission today, so hopefully it will be a part of the next OSG
release.
To get around the problem you can add an eventCallback and a updateCallback
to the slave camera that is not using the mastersSceneData and modify the
traversal mode of the visitor within the callback to traverse the camera's
subgraph.
class SlaveCameraUpdateCallback : public osg::NodeCallback
{
public:
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
{
if(nv->getVisitorType() == osg::NodeVisitor::UPDATE_VISITOR)
{
osg::NodeVisitor::TraversalMode tm = nv->getTraversalMode();
nv->setTraversalMode(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN);
traverse(node,nv);
nv->setTraversalMode(tm);
}
else
{
traverse(node,nv);
}
}
};
{
//Rigging up slave camera with it's own subgraph
viewer.addSlave(camera,false);
//Set updateCallback for camera to ensure subgraph updateTraversal
camera->setUpdateCallback(new SlaveCameraUpdateCallback);
}
Filip
On Mon, Jul 20, 2009 at 5:25 PM, Timm Linder <[email protected]> wrote:
> Hi Robert,
>
> I'm picking up this somewhat outdated topic since we are having a similar
> problem. We need to render some of our geometry with a separate depth buffer
> because of precision issues: In the first pass, we are rendering a very
> large landscape that was created using VirtualPlanetBuilder. This puts the
> far clipping plane very far away from the viewer.
>
> Then, however, we need to draw some objects that are flying very close to
> the camera and need a lot of precision here. This is what makes us require a
> second rendering pass with a separate depth buffer and projection matrix
> (where the far plane is very close to the eye point). It is guaranteed that
> this geometry is always above the landscape, so we need no further sorting
> here.
>
> In both passes, we require our update callbacks to work. As should have
> become clear from my description, the master and slave camera do not share
> their geometry.
>
> Do you think there is a way of making the update callbacks work in the
> slave camera *without* tampering with the original OSG Core source code?
>
> Any hint would be greatly appreciated.
>
> Thanks a lot for your help,
>
> Timm
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=15145#15145
>
>
>
>
>
> _______________________________________________
> 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