Hi Real --

The code you quoted is rather odd in that it doesn't set the View matrix. I
can only assume that some further Camera configuration must be done
elsewhere.

I'm also not sure why that Camera node would be placed as a child under a
Transform node, because the Camera reference frame is set to ABSOLUTE_RF,
which basically causes it to ignore the effects of any parent
transformations.

Perhaps this custom Camera classis taking the accumulated transform from its
parents and incorporating it into a View matrix that it sets every frame?
This is just speculation.

Not sure why your own code wouldn't work. If, as I suspect, more Camera
configuration is done on your AR Camera elsewhere, and you have failed to do
similar configuration to your Camera (such as set the View matrix), then I
would expect to encounter some problems.

Regarding the documentation, this has been discussed before. Search the
archives. In summary, someone who wants good docs needs to step forward and
fund it. I would gladly take on such a client.

Paul Martz
Skew Matrix Software LLC
http://www.skew-matrix.com
+1 303 859 9466

-----Original Message-----
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Real Name
Sent: Saturday, May 02, 2009 9:00 AM
To: osg-users@lists.openscenegraph.org
Subject: [osg-users] [beginner question] How to render from custom camera?


Hi everybody,

I am using osgART for an AR project I'm currently working on, which joins
osg and ARTookit -- but since my question is rather regarded to osg, I'm
asking you folks...

In osgART the developers seem to create a custom camera they place inside
the scenegraph, under a transform node which continuously gets updated
regarding to ARToolkit tracking results.

Well, I'm using a CompositeViewer to create two views in seperate render
windows rendering the same scene. Only one view is showing the scene updated
from AR tracking, the other one is supposed to show the scene from a
position I want to be able to modify in my code.

For consistency reasons I really want to create the camera for my second
view the same way osgART does in the first view, this looks pretty straight
forward in their code: 

Code:
osg::Camera*
Calibration::createCamera() const
{
        osg::Camera* cam = new osg::Camera();
        cam->setRenderOrder(osg::Camera::NESTED_RENDER);
        cam->setProjectionMatrix(_projection);
        cam->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
        
cam->setComputeNearFarMode(osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR);

        return cam;     
}


In the example code which is provided the so created camera simply gets
added to the scene graph in some position (below this AR-transform node I
mentioned above) and that's it. (Question aside: What happens to the default
camera in this case? And: Can I get rid of it/replace it?)

If I do this the exactly same way my view seems to continue to render from
the default camera created within the view instance. Do you have an idea
what I am missing there? I debugged into osgART and couldn't find some
view.addSlave() or something similar. 

Unfortunately I'm a little overstrained by the tremendous extent of osg, the
available guides seem to be scattered about several websites, wikis,
tutorials, etc. while the actual (doxygen) documentation is very sketchy and
little illuminating. as you might know this makes it very difficult for
beginners to get into it. I found examples using osgProducer::Viewer, or
Producer::Camera, slave cameras and many funny things I wonder why there
have to be so many different ways of implementing, but I really would like
to keep my way of creating this cam consistent to the way it is done in
osgART -- there really has to be a very simple way to do this in a clean way
but I cannot find it. 

Thanks for reading through all of this, and thanks in advance for your help.

PS: A few weeks ago I tried to replace the default viewer camera by the
custom camera to not have a camera that is not needed anyway but I failed
finding a way to do this. Is this possible anyway?

PPS: What is it about this default camera anyway? It looks kind of weird to
me that the default camera is not part of the scenegraph, after all it's a
node like everyone else. Or did I get something wrong here? Maybe someone
can point me to a place where this whole osg-architecture is explained in
detail so this is clarified once and for all IN A COMPACT WAY? (If I had
enough time, I would enjoy reading into everything I can find but
unfortunately I haven't...) Every time I debug into osg::Viewer I wonder how
this all works together...

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=11233#11233





_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to