Re: [osg-users] [beginner question] How to render from custom camera?
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 _
Re: [osg-users] [beginner question] How to render from custom camera?
Thank you for your answer. Like I already assumed before, this was a huge misunderstanding of what cameras are in osg. I didn't read Of Cameras and Scenes (http://andesengineering.com/OSG_ProducerArticles/CamerasAndScenes/CamerasAndScenes.html), especially the section The Point because I thought to already know what can be found in there, since I already worked with several game engines, all of them using the term "camera" as what I would expect a camera to be (and many others by the way...), namely an object actively rendering the scene to a framebuffer from its position, with its orientation. SUGGESTION: Maybe outline this more clearly so it cannot be overlooked that easy. And Realy name the Section "Why Cameras don't belong in the Scene Graph" to catch peoples attention. This camera terminology is an evil pitfall for osg beginners who are experienced using game engines! :) -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=11437#11437 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [beginner question] How to render from custom camera?
Hi What ever you real name is because you too much of ?? to use a reasonable human readable name, please fix it if you want respect from this community. On Wed, May 6, 2009 at 11:01 AM, Real Name wrote: > Thank you for your answer. > > Like I already assumed before, this was a huge misunderstanding of what > cameras are in osg. I didn't read Of Cameras and Scenes > (http://andesengineering.com/OSG_ProducerArticles/CamerasAndScenes/CamerasAndScenes.html), > especially the section The Point because I thought to already know what can > be found in there, since I already worked with several game engines, all of > them using the term "camera" as what I would expect a camera to be (and many > others by the way...), namely an object actively rendering the scene to a > framebuffer from its position, with its orientation. > > SUGGESTION: Maybe outline this more clearly so it cannot be overlooked that > easy. And Realy name the Section "Why Cameras don't belong in the Scene > Graph" to catch peoples attention. This camera terminology is an evil pitfall > for osg beginners who are experienced using game engines! :) Don's article of Andes Engineering is a position paper from Don on the topic of scene graph and cameras. It's a position that I don't subscribe too. OSG since 2.x does not use Producer, and doesn't have this division between cameras and scene graphs. In OSG 2.x a "Viewer" has a "View" of a "Scene" and a master "Camera" that takes picture of that "Scene". A Camera can used external to the scene graph such as with a master or slave Camera in a View(er) or in the scene graph for RTT effects such as shadows, or HUDs. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [beginner question] How to render from custom camera?
robertosfield wrote: > Hi What ever you real name is because you too much of ?? to use a reasonable > human readable name I think there is no reason to get offensive -- as you might understand I formed a habit of not using my name on public forums. robertosfield wrote: > please fix it if Done. Thanks for your additional comments, I think (hope) it's clear to me now. ithrak (Jason Fisher) -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=11452#11452 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [beginner question] How to render from custom camera?
Hi Jason ;-) On Wed, May 6, 2009 at 12:03 PM, Jason Fisher wrote: > > robertosfield wrote: >> Hi What ever you real name is because you too much of ?? to use a reasonable >> human readable name > I think there is no reason to get offensive -- as you might understand I > formed a habit of not using my name on public forums. You come up with a name that was taking the piss and I respond to it. > robertosfield wrote: >> please fix it if > Done. > > Thanks for your additional comments, I think (hope) it's clear to me now. Camera's and scene graphs aren't all clear cut, the concept and implementation is often used and abused all over the place. In the case of scene graphs like the OSG Camera's are something that is used in lots of different ways, but still in not some ways that some users expect. The one place that can sometimes confuse users is that you can't put a Camera as a leaf of the scene graph and expect to get the view of the scene graph from where that camera has been placed. Rather you'd get a picture of nothing in the OSG's case. In the OSG's case a Camera only renders what is below it in the scene graph, the Camera effectively "owns" the scene graph it's rendering, and the view matrix positions the world below it into it's own local eye coordinates. This fits with the concept of an OpenGL camera, but is obviously quite different from a physical camera. To achieve the positioning of the camera's view relative to scene graph elements you have to track nodes in the scene graph (such as a CameraView node) and accumulate the local to world transforms above the CameraView (or any node) on each frame to apply the inverse of this local to world matrix as the camera's view matrix. This arrangement while being a bit different from a physical camera turns out to be extremely flexible and best for integrating with other scene graph concepts and class implementations. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [beginner question] How to render from custom camera?
robertosfield wrote: > You come up with a name that was taking the piss and I respond to it. Well, sorry to anyone who felt kidded, in fact I'm not using this mailing system you obviously use. I'm posting to the phpBB forum where this "real name" isn't present at all, so I thought it might not be used anyway. ithrak (Jason Fisher) -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=11462#11462 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [beginner question] How to render from custom camera?
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 -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=11665#11665 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [beginner question] How to render from custom camera?
Yeah, I made a mistake on that too, so forget this. I was sure to remember that the camera gets moved by the transform node. But I was wrong, this probably resulted from my misunderstanding of cameras. Since I'm used to game engines it made more sense to me the camera instead of the scene would be moved and I seemingly swapped this in my mind at some time. Too much confusion on that day... ithrak (Jason Fisher) -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=11677#11677 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org