Hi Maria,
   I have tried using the setClampProectionMatrixCallback and make my 
implemetation from osg::_clampProjectionMatrix only make the follow change to 
calculate far plane from znear and nearfarratio.

// osg::_clampProjectionMatrix implementation:
//double min_near_plane = zfar*nearFarRatio;
//if (desired_znear<min_near_plane) desired_znear=min_near_plane;

// my implementation:
double max_far_plane = znear/nearFarRatio;
if (desired_zfar>max_far_plane) desired_zfar=max_far_plane;

But it seems not work well. Can you show me your implementation?
Thank you!



María Ten wrote:
> Hi,
> 
> You can disable the auto-compute near far and give a fix value for near and 
> far. 
> 
> If this method don't solve your problem you can add a callback to your root 
> node in the scene using the setClampProjectionMatrixCallback method of the 
> cullvisitor and override the clampProjectionMatrixImplementation method in 
> the class ClampProjectionMatrixCallback. In my implementation I compute the 
> nearest point in the geometry to set the near plane and then adjust the far 
> plane depending of the near plane and the nearFarRatio.
> 
> This little hack work for my with very large terrains culling the far objects 
> in the scene instead of the nearest objects.
> 
> Cheers,
> 
> Maria.
> 
> On Mon, Jun 29, 2009 at 11:27 AM, Ren Liwei < ()> wrote:
> 
> > Hi,
> >  In my scene there is an earth and some small models on it.  Sometimes i've 
> > got a screenshot like the attachment when i turn auto-compute near far on.
> >  I known that's becuase the auto-computed near plane is too far to let 
> > nearer primitives in. So i tried giving a very little nearfarratio and then 
> > it worked somewhat. But when i added an even larger sky sphere into the 
> > scene, once again i fall into trouble with near far.
> >  So what should i do with near far when there are both very near(less then 
> > 1) and far away(far then 100000000) things to show in the secen.
> > 
> > Thank you!
> > 
> > Cheers,
> > indif
> > 
> > ------------------
> > Read this topic online here:
> > http://forum.openscenegraph.org/viewtopic.php?p=14637#14637 
> > (http://forum.openscenegraph.org/viewtopic.php?p=14637#14637)
> > 
> > 
> > 
> > 
> > _______________________________________________
> > osg-users mailing list
> >  ()
> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org 
> > (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org)
> > 
> > 
> 
> 
> 
> -- 
> María Ten Rodríguez
> Instituto de Automática e Informática Industrial  http://www.ai2.upv.es 
> (http://www.ai2.upv.es)
> Ciudad Politécnica de la Innovación 
> Universidad Politécnica de Valencia
> 
>  ------------------
> Post generated by Mail2Forum


------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=14733#14733





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to