Hi,
 
I'm trying to integrate some complex openGL code into my scene.
It draws a sky, and works nicely if I set the DO_NOT_COMPUTE_NEAR_FAR.
 
So, we had an example of how to make the precipitation effects work,
which involved using osg::Precipitation.
 
to do the precipitation, which requires a very close near clip
You grab the osgViewer->getCamera()->getProjectionMatrixAsFrustum(left,
right, bottom, top, near, far)
then turn off the depth test / writing, and do a
setProjectionMatrixAsFrustum(left,right,bottom,top,1.0, 5000) on a
osg::Projection node.
 
And it all works fine. Easy way to reset the near far clip, since the
precipitation is drawn last.
 
Now I need to do the opposite. I need to extend the far clip way out,
and then allow OSG to do it's regular NEAR_FAR compute.
 
So I do this:
 
osg::Projection *proj = new osg::Projection.
osgViewer->getCamera()->getProjectionMatrixAsFrustum(left, right,
bottom, top, near, far); 
proj->setMatrix(osg::Matrix::frustum(left, right,bottom,top,1000,
1000000);
 
// additional stuff to proj to turn off depth testing.
 
proj->addChild(mySky);
SceneData->addChild(proj);
 
But it doesn't work. Lots of flashing. 
 
The Sky renderbin is -1, so I know it renders first.
 
How does osg handle osg::Projections when the DO_NOT_COMPUTE_NEAR_FAR is
not set?
 
I would like to leave that functionality on so that it can give me the
best ratio for the rest of the scene.
 
Now that I am thinking about it, I am wondering if the camera and node
projections are stacking.
What's the best way to simply have the near/far for my sky node be
different? This shouldn't be bad since depth isn't involved.
 
Thanks,
 
Chris
 
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to