Hi Ufuk, Joseba,

and also i dont believe culling far plane is a good idea if you are
rendering large area, the increment of performance will not be dramatic.

Actually I've been in a similar position in the past, and my reason to do it in two passes was so that the very large node (in my case it was a skydome) would not affect my ability to see objects from very close up.

As you know, OSG automatically computes near/far planes by default based on your scene, and if the ratio between the computed near and far planes is too small, it will push the near plane forward. That means that objects close to the camera will suddenly be clipped. But on the other hand, I don't want to manually place the near/far planes, or decrease the near/far ratio too much, because then the depth precision will be diminished and I will get z-fighting.

So one solution was as Joseba suggested, render the skydome in one camera and the rest of the scene in another. Another was to use callbacks to disable near/far plane calculation on the skydome. This only worked because a skydome is always drawn at the far plane and never interacts with scene objects. In Joseba's case this would not work because the terrain interacts with scene objects, so to resolve depth correctly between the two, both need to use the same depth buffer and range.

Joseba, I don't know why you're getting a black screen, but as I said above, using two cameras with different projection matrices won't work for you because then the terrain and the rest of the scene won't have the same depth range, and you'll get artifacts. What you could do however, is split your terrain so you can render the far off part first, with a separate camera and with depth testing and writing disabled, and then render the close part (that interacts with the other scene objects) normally. You could even make a system that determines which terrain tiles are far away automatically each frame so you can move across the whole terrain without problem. Make sure you disable depth and color buffer clearing in the second camera.

Another option might be to use a skybox to simulate far off terrain instead of geometry.

Hope this helps,

J-S
--
______________________________________________________
Jean-Sebastien Guay    jean-sebastien.g...@cm-labs.com
                               http://www.cm-labs.com/
                        http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to