After looking at this post:

http://www.openscenegraph.net/archiver/osg-users/2006-April/0072.html

I tried playing with the cull settings. Setting NO_CULL has no effect,
while setting VIEW_FRUSTUM_SIDES_CULLING gives totally random results
of what gets culled. Things in the middle of the model sometimes get
culled while things right on either side of it (nearer and farther)
are still visible.

Setting SceneVIew::setCullMask(0) also disables all rendering. What
the.. is going on?!?!?!?!

On 10/6/06, c sklu <[EMAIL PROTECTED]> wrote:
Hi,

I'm really getting puzzled about this. I'm getting problems with the
clipping planes when in orthographic mode. Just to make sure, I turned
off computeNearFarMode in osgUtil::SceneView and calculate the near
far values myself using something like:

void computeNearFar( osg::Node const * node, osg::Camera const & cam,
                                 double & nearClip, double & farClip )
{
  osg::BoundingSphere const & bs = node->getBound();
  osg::Matrix mat(cam.getLens()->getMatrix());
  osg::Vec3 pos(mat(3,0),mat(3,1),mat(3,2));

  double dist = (bs.center()-pos).length() * 1.5; // add a bit of a buffer

  // nearclip cannot be <= 0.0 in perspective mode
  // should really use near/far ratio to set min distance
  nearClip = cam.getLens()->getProjectionType() ==
osg::Camera::Lens::Perspective
                 ? max(dist-bs.radius(),0.1) : dist-bs.radius();
  farClip  = dist+bs.radius();
} // computeNearFar

This however is providing worse results then when I let SceneView
calculate near/far for me. I'm using the Producer::Trackball to move
the camera around and disable distancing when in orthographic view
mode.

Is there something wrong with my perception of near far values in
orthographic mode?

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to