Hi Ulrich and Oscar,

There has be lots written about osgViewer and master and slave Cameras
over the last eighteen months, so have a look through the archives.

Slave Cameras are typically used for multiple pipe systems, and as
designed so that they have their own projection and view matrices set
by multiplying masters view/projection matrix by the slaves
view/projection offset matrices.  For this mode one uses a slave
Camera with its ReferenceFrame set to RELATIVE_RF (which is the
default setting).

You can also use Slave Cameras to do HUD's or effects like distortion
correction, in these cases you set slave Camera's the reference frame
to ABSOLUTE_RF, and even disabling the inheritance of the masters
scene data if required.  Once the ABSOLUTE_RF is select the slaves
projection and view matrix are not updated on each frame, rather just
left completely.

Robert.

On Wed, Aug 20, 2008 at 12:46 AM, Ulrich Hertlein <[EMAIL PROTECTED]> wrote:
> Hi Oscar,
>
> Oscar De Leon wrote:
>> I've tried to add a slave camera using setViewMatrixAsLookAt to an
>> example but i cannot get the desired result. I try to view a boat from 2
>> different points. Here is the code:
>>...
>>         for(unsigned int i=0; i<numCameras;++i)
>>         {
>>             osg::ref_ptr<osg::Camera> camera = new osg::Camera;
>>             camera->setGraphicsContext(gc.get());
>>...
>> camera->setViewMatrixAsLookAt(osg::Vec3d(0,0,10),osg::Vec3d(0,0,0),osg::Vec3d(0,1,0));
>>...
>>             viewer.addSlave(camera.get(), osg::Matrixd(),
>> osg::Matrixd::scale(aspectRatioScale,1.0,1.0));
>>         }
>
> I've been struggling with slave cameras in the past as well and found some 
> caveats using them:
> - the slave Camera reference frame must be RELATIVE_RF
> - the slave Camera's matrices (View and Projection) are *overwritten* by the
> masterCamera.matrix * offset (again for both View and Projection)
>
> So the setViewMatrixAsLookAt() is ignored and overwritten.  You definitively 
> cannot have a
> camera with an independent position and only different ViewMatrix.
>
> In the end I decided for myself that slave cameras are probably more (only?) 
> useful when
> having multiple render windows/contexts like having two OTW views with 
> slightly rotated
> view frusta.
>
> I ended up using a Camera node for the same task which works beautifully but 
> if you want
> to keep things (like view angle) in sync you have to do it manually.
>
> If someone could confirm this I'd be willing to write a wiki entry about 
> slave cameras.
>
> Cheers,
> /ulrich
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to