I recommend you search the archives for the recent thread "Uniform per
slave Camera". Several solutions, including the solution I eventually
used, are discussed in that thread.
Paul Martz
Skew Matrix Software LLC
_http://www.skew-matrix.com_ <http://www.skew-matrix.com/>
+1 303 859 9466
Emmanuel Roche wrote:
Hi everyone,
I'm facing a problem I cannot solve by myself here, I thought I could
just ask:
- I have a scene (so a scene graph)
- I use multiple View on this single scene
--> Currently I have an "homemade" mixture of customized
osgViewer::Viewer objects to deal with everything so basically, for each
View, I go through a complete (EventTraversal(), UpdateTraversal(),
RenderingTraversals() ) loop sequentially.
- Now I would like to switch to a CompositeViewer and thus go through
the event/update traversals only once per Scene (If I understand the
CompositeViewer design properly).
But I have a very specific problem to solve here:
In my scene graph I use shaders and uniforms. those uniforms have update
callbacks, and in those update callbacks, I retrieve my currently
rendering View and then the View matrix to generate eye coordinates.
--> I assume using the osg_ViewMatrix uniform is not an option for me
because I need to convert very big position vector and very big view
matrix translation, and I would clearly get a problem here if I don't
have double precision.
--> With the CompositeViewer I can't access the individual "View"
anymore in the update traversal() since this process is "View agnostic"
I would say.
--> Since my views will need different settings for the uniforms, I was
thinking I would just need to do something in the cull traversal, but
here I realized something which seems strange to me: there is no such
method as uniform::setCullCallback(...)
So, the question is, how would you update your uniforms properly in that
case ?
I mean, I could still put a cullcallback on the node owning the stateset
containing the uniform for instance and "update" from here (assuming I
can retrieve the Viewmatrix I need somehow in that Cullcallback...) but
is this really the best option ??
- And generally speaking, would a uniform::setCullCallback() not make
sense for some reason I'm apparently missing for now ?
Bonus question by the way: How would I access the "master camera"
ViewMatrix in a cullcallback ? i've seen we have
osgUtil::CullVisitor::getCurrentCamera() but would this return the
Master camera of the View or just the current camera in the scene graph
(as I use DepthPartitionNode I have many sub cameras in my scene...)
Thanks in advance is someone has any tip/advise/complete solution on
those questions!
Regards,
Manu.
------------------------------------------------------------------------
_______________________________________________
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