Hello Wojtek, thanks for the tips !! I will try with getRenderStage()->getCamera() and let you know if it works for me too.
But concerning the cull callback for uniforms, isn't it already the case for the update callback you can put on them ? (if you use the same uniform in multiple statesets/nodes, then the update callback is called multiple times per frame... [or is there some kind of "security system" to prevent this I'm not aware of ? ] Cheers, Manu. 2010/1/29 Wojciech Lewandowski <[email protected]> > Hi Manu, > > IMHO I can offfer tips for 2 or your questions: > > Why no cull calback for uniform ? > I guess there is no cull calback for state attribs/uniforms because they > could be used many times and located in many statesets/nodes. So cull > visitor can traverse them couple times per one frame. > > How to obtain master camera view matrix ? > In ViewDependentShadowTechniques I used following method to obtain master > view or slave view camera: > cullVisitor->getRenderStage()->getCamera() > > Depending on your setup of extra cameras it may wortk or not, but I guess > you could try it. > > Cheers, > Wojtek Lewandowski > > > > ----- Original Message ----- > *From:* Emmanuel Roche <[email protected]> > *To:* OSG Users <[email protected]> > *Sent:* Friday, January 29, 2010 1:08 PM > *Subject:* [osg-users] uniform update question > > 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 > >
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

