Hi Frank, On 6 December 2012 13:50, Frank Kane <fk...@sundog-soft.com> wrote:
> Let's say I have two cameras with identical view frusta, say a main camera > and a camera for reflections that contain the same objects, only flipped. > > Is there any way I can avoid incurring the overhead of culling once for > each camera, when the results will be the same for both? Basically I'd like > to have two cameras share the results from one culling pass if possible. > I wouldn't recommend trying to be "clever" by reusing culling results as the rendering backend is rather more sophisticated than just a list of results - the OSG's culling traversal creates a rendering graph that stores the projection and modelview matrices for each rendered Drawable along with the complete state graph required to make sure the Drawable is rendered with the correct OpenGL state. In your case the reflection will mean that the modelview matrix will be different for each rendered Drawable so will require a separate RenderLeaf that binds the projection and modelview matrices to the Drawable. This means even though the leaves and the bulk of OpenGL state is same the rendering graph will have to be different. In theory you could clone the rendering graphs and modify the duplicate and modify the modelview matrices to achieve the required result, but this requires a pretty deep understanding of the internals of the OSG's rendering back end is rather more complex than one might - the complexity comes from the flexibility of the OSG to manage dynamically multiple rendering stages and passes. This complexity is hidden from most users thanks to the scene graphs front end - users just worry about RenderBin's and in scene graph osg::Camera for render to texture effects. Robert.
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org