Hi Litingbaotou,

On Mon, Apr 21, 2008 at 12:57 PM, litingbaotou <[EMAIL PROTECTED]> wrote:
> Thanks for your advise, I think it's a near plan clipping problem. I've
> tried change the near plan param in setProjectionMatrixAsPerspective () from
> 0.000001 to 1.0, but it didn't work. Could you give me some advise about how
> to fix this near plan clipping problem? Thanks.

By default the OSG automatically computes the near and far planes so
they encompass the
scene, when you have a big scene this push the far plan out as far as
the most distant point in your
view frustum.  If you are inside the model then the near plane will in
effect move to coincide with
the eye point - but OpenGL can't handle near plane distances of 0 so
it'll compute it's position
based on a near distance = near far ratio * far distance.

The near far ratio is stored in the osg::CullSettings class, which is
inherited into osg::Camera, if
you lower the near far ratio, then the near plane will move near to
you - so it'll clip out less, but...
the downside is the depth precision of the depth buffer goes down so z
fighting will become more likely.

  camera->setNearFarRatio(0.0001f;); // default is 0.0005f;

Alternatively you can set the env var OSG_NEAR_FAR_RATIO to the value
you want, this will override
the default.

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

Reply via email to