Hi Joan,

The problem is down to the SceneView's default light position being a
directional light in eye space, and obviously the direction is
different for each of the tiles.

Try inserting an osg::LightSource in the scene so that all the slaves
are sharing the same lighting set up.  You shouldn't need to go any
where need SceneView.  See the osglight example.

Robert.

On 4/18/07, Joan Slottow <[EMAIL PROTECTED]> wrote:
My program run on three nodes of a tiled display.  I am doing all the
communication between the nodes and doing the tiling myself.  I am also
following the instructions in the  FAQ titled:


   Q: Can I use OSG within an existing renderer?

In the program running on the center node, the camera is pointed straight
ahead.  I the program running on the left node, the camera is pointed about 50
degrees left of center, on the right node the camera is pointed about 50
degrees right of center.  We are running this to 3 projectors that are
displaying on a large screen that is a portion of a sphere (horizontally its
less than half the sphere) with overlap being blended by hardware.

There problem is that in each of the displays, the lighting is coming from a
different direction (because the camera is pointed differently) and this
results in a disconnect in the lighting when you look at the whole on the
screen.

I tried  setLightingMode(osgUtil::SceneView::SKY_LIGHT),  HEADLIGHT, and
NO_SCENEVIEW_LIGHT in turn on the osgUtil::SceneView but can detect any
difference so I decided to send the view matrix from the center to the sides.
In the program rinning on the center I did:

   osg::Matrixd mTileLightingViewMat = mSceneView -> getViewMatrix(  );

and then I passed that matrix over to the sides:

On the sides I did:

      mSceneView ->cull();
      osgUtil::RenderStage* renderStage = mSceneView -> getRenderStage(  );
      osg::ref_ptr<osg::RefMatrix> mv =
         new osg::RefMatrix(  mTileLightingViewMat );
      renderStage -> getPositionalStateContainer(  ) -> reset(  );
      renderStage ->
         addPositionedAttribute( mv.get(  ), mSceneView -> getLight(  ) );
      mSceneView ->draw();

If I do that, I see the sides becoming much darker than the center.

This is explained by the fact that I am calling reset(  ).  If I print out the
number of matrices on before doing the reset:

   std::cerr << "number of light matrices on list before reset "
             << renderStage ->
                getPositionalStateContainer(  ) -> _attrList.size(  )
             << std::endl;

I see that there are two where as I only see one being put on in the OSG code
in osgUtill::SceneView.cpp where it says:

    case(HEADLIGHT):
        if (_light.valid()) renderStage->addPositionedAttribute(NULL,_light.get
());
        else osg::notify(osg::WARN)<<"Warning: no osg::Light attached to
ogUtil::SceneView to provide head light.*/"<<std::endl;
        break;
    case(SKY_LIGHT):
        if (_light.valid()) renderStage->addPositionedAttribute(mv.get(),_light
.get());
        else osg::notify(osg::WARN)<<"Warning: no osg::Light attached to
ogUtil::SceneView to provide sky light.*/"<<std::endl;
        break;
    default:
        break;


So to compensate for that I ran the same code on the center as I did on the
sides all of them were darker than originally but I still say the same
discontinuities as I did before and it still looked as if the lighting was
applied at different angles.

What is the solution two the problem of getting all three instances of the
program to do the lighting as if it were a single view?

Thank You

Joan Slottow



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

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

Reply via email to