Hi Robert,
Just tested at this end and can confirm the problem resulting from setting the viewMatrix seems to be fixed. Thankyou! But I am still worried that something is still not quite right though, because the object below the nested camera seems to quite often return a single intersection. By my reckoning, a ray should always pass though zero or two polys of an enclosed convex shape. Indeed, it always seems to return two intersections per object when there is no nested camera is involved, so what's going on?
Chris.

----- Original Message ----- From: "Robert Osfield" <[EMAIL PROTECTED]>
To: "Chris Denham" <[EMAIL PROTECTED]>
Cc: "OpenSceneGraph Submissions" <[email protected]>
Sent: Thursday, November 06, 2008 1:32 PM
Subject: Re: [osg-users] Problem with computeIntersections for nodes below post render camera


Hi Chris,

Do you have an example that illustrates this point?  Could you explain
more thoroughly as I'll have a bash at resolving this while I'm
looking at this code.

In doing a review of IntersetionVisitor::apply(Camera&) I've come to
the conclusion that the changes you provide need tweaking to reflect
how the modelview matrix is actually managed with relative cameras.
It's actually a bit convoluteed but hopefully an explanantion will
make sense:

When you have a Camera set up with TransformOrder set to PRE_MULTIPLE
(which is the default) and the ReferenceFrame set to RELATIVE_RF then
multiplication for the modelview matrix is:

  modelview' = camera.getViewMatrix() * modelview;

Which if broken down into the model and view parts is:

  model' = camera.getViewMatrix() * model;
  view' = view;

Note that the new camera view matrix affects the model matrix not the model.

In the case of TransformOrder set to POST_MULITPLE the order is:

 modeview' = modelview * camera.getViewMatrix();

Which if broken down is:

 model ' = model;
 view' = view * camera.getViewMatrix();

The attached IntersectionVisitor.cpp and IntersectionVisitor implement
this.  Note these files are based on the svn/trunk version, rather
your own as your own lacks some recently changes to other parts of
IntersectionVisitor.

I've tested:

  osgpick --relative-camera-scene

And it works fine with these changes.  Could you test at your end?

Robert.


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

Reply via email to