Hi Sebastian and aperuggi, I too am tempted to revive this old thread. My observation regarding the Z near/far values for a PRE_RENDER camera is that they are always inherited from the master camera. Like you, I have the following scene graph:
MainCamera | +--PreRenderCamera - RELATIVE_RF .....| .....+-- PreRenderSceneGraph (child of PreRenderCamera) | +--MainSceneGraph Both cameras are configured so that near/far are calculated using bounding volumes (COMPUTE_NEAR_FAR_USING_BOUNDING_VOLUMES). According to my tests, it appears that the Z near/far values for 'MainCamera' are calculated by the OSG using the bounds of 'MainSceneGraph'. The *same* values are used for PreRenderCamera, that is, PreRenderCamera does not calculate its own Z near/far values based on its own underlying scene graph, 'PreRenderSceneGraph'. Does this match your experience too? Any insight would be greatly appreciated! Regards Fred Sebastian Messerschmidt wrote: > Hi, I want to revive this relatively old thread. > Can someone help me with the problem? I wasn't able to solve it. > Setting the projection matrix of the PreRender2-pass in a cull callback > doesn't help really. > > The problem behind this, is simply the fact, that the PreRender2-pass > has a different scene(or at least a different cullmask) and will compute > the incorrect near/far values. So I really need the near/far computation > to be done by the first pass and used by the second pass. > > cheers > Sebastian > > > Hi folks, > > > > In my deferred setup I have multiple cameras rendering different > > subgraphs of the scene. > > > > Setup is more or less like this: > > > > MainCamera > > | > > PreRender1 - RELATIVE_RF(Gbuffer) > > | > > PreRender2- RELATIVE_RF(Transparent objects) > > | > > PreRender3 - ABSOLUTE_RF (SSAO) > > | > > ... > > | > > OutCamera - ABSOLUTE_RF (FullScreen Quad) > > The cameras are all rendering to framebuffer rendertargets and setup > > their render order as in the diagram above. > > > > > > This works really fine as long as I use > > setComputeNearFarMode(osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR); > > If I switch to any other mode in the PreRender1 the other cameras seem > > to use their original near/far. > > I already tried to set the projection matrix of the other cameras in a > > cull-callback (on the main and on the PreRender1) but it seems after > > the cullvisitor has traversed the projection-Matrix of the camera > > still shows the same near far planes. > > Also I tried to install a ClampProjectionMatrixCallback to the > > MainCamera. This worked, but unfortunally with the same result. The > > projection is indeed clamped, but it is not applied to the other > > relative cameras. > > The last hours I tried to play around with the inheritance masks of > > the cameras but this didn't help in any way. > > > > Any Idea what I'm doing wrong here? > > Also could someone explain to me what the difference between the > > PreRender and the NestedRender are in this setup? > > > > cheers > > Sebastian > > > > _______________________________________________ > > osg-users mailing list > > > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > > > _______________________________________________ > osg-users mailing list > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > ------------------ > Post generated by Mail2Forum ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=54394#54394 _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org