Hi Janna,

There are a couple of ways of tackling per view specialization,

 1) Use a custom Node::traverse(NodeVisitor&) or NodeCallback that
provides a specialized operation per cull traversal - either
dynamically pushing state/modelview matrices onto the CullVisitor.
You can look at the NodePath and current Camera that is being tracked
by the CullVisitor to find out which window.  Caching data can be done
on a per CullVisitor basis - NodeKit's like osgShadow use this
extensively by have local data structure cached for each cull visitor.

2) Use a per view cull TraversalMask on each View's master Camera to
select a different path in the scene graph by matching the NodeMask of
the subgraphs.  The osgstereoimage example provides a simple example
of this.

3) Use a DrawCallback as you have done.

4) Use a Uniform attached to StateSet attached to each View's master
Camera and then use this uniform in a shader to determine what do for
each view.

Which route to take will depend on exactly what you are trying to
achieve.  For computing an object scale I'd suggest a custom cull
callback or node that dynamically computes that modelview matrix
approach for each view to scale the subgraph appropriately, the cull
callback would push/pop the modelview matrix.  Another route would be
to use a custom Transform node that provides a custom computation of
the modelview matrix.   If you are going to be using this behavior a
lot then a custom node might be the most sensible route forward.

Robert.

On 7 March 2013 16:30, Janna Terde <brja...@gmail.com> wrote:
> Hi,
>
> I've been looking into the way to enable per-view (per-camera) control of the 
> various visual effects. For example one of the effects is using camera 
> position and orientation for computation of the object scale.  I would like 
> to add an object once into the scene graph, have multiple views and make sure 
> that computation for the each view is done correctly (correct camera 
> information is used).
>
> I am trying to use  osg::Camera::DrawCallback as pre draw callback. And 
> recompute objects scale there before each camera rendering. Is it the right 
> way to go?
>
> Thank you!
>
> Cheers,
> Janna
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=52978#52978
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to