[osg-users] Using TerrainManipulator when the projection matrix is in Ortho mode
Greetings! I'm experimenting using the a scene graph projected in Ortho mode using the setProjectionMatrixAsOrtho function on the camera and while using the TerrainManipulator on the camera I noticed that the pan is working, but zoom is not! In fact, the only way that I could affect any kind of zoom was to narrow the POV on the camera (that realty is not a zoom). I tried to look for any examples but came up short. Is there any switch or methodology that I missed that can give me an Ortho projection of an otherwise a 3D scene graph? ... Happy New Year All D Glenn D Glenn (a.k.a David Glenn) - Moving Heaven and Earth! -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=35303#35303 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Using TerrainManipulator when the projection matrix is in Ortho mode
Hi David, I'm experimenting using the a scene graph projected in Ortho mode using the setProjectionMatrixAsOrtho function on the camera and while using the TerrainManipulator on the camera I noticed that the pan is working, but zoom is not! In fact, the only way that I could affect any kind of zoom was to narrow the POV on the camera (that realty is not a zoom). Well in fact yes... Zoom, in camera-speak, is making the FOV of the camera smaller/larger. What the normal manipulators do to zoom is to move the camera itself, i.e. dolly in/out in camera-speak. You may have seen the dolly in zoom out effect in movies, where the camera dollies in while doing a zoom out with the lens at the same time, and I use that expression to help me remember the difference between the two. http://en.wikipedia.org/wiki/Dolly_zoom http://en.wikipedia.org/wiki/File:Contra-zoom_aka_dolly_zoom_animation.gif But to get back to your question, this is an FAQ... Since with an ortho camera moving the camera forward or back will have no visible effect (apart from when you start hitting your near/far planes), you won't be able to zoom with the normal camera manipulators in an ortho view. You will have to make your own manipulator or use another way of changing the camera's left/right and top/bottom clipping planes, effectively the camera's field of view (though in ortho it's not a frustum, but a box). I kind of wish (and I've expressed this wish in threads that asked the same question before, but haven't had time to do anything about it) that the OSG camera manipulators supported affecting other parameters of the camera than just its view matrix. As it is, you'll have to affect the projection matrix yourself directly, i.e. your camera manipulator will have to know about the camera(s) it's affecting, which defeats the nice loose coupling that we have between camera manipulator and camera otherwise. Hope this helps, J-S -- __ Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com http://www.cm-labs.com/ http://whitestar02.webhop.org/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Using TerrainManipulator when the projection matrix is in Ortho mode
Skylark wrote: Hi David, Well in fact yes... Zoom, in camera-speak, is making the FOV of the camera smaller/larger. What the normal manipulators do to zoom is to move the camera itself, i.e. dolly in/out in camera-speak. You may have seen the dolly in zoom out effect in movies, where the camera dollies in while doing a zoom out with the lens at the same time, and I use that expression to help me remember the difference between the two. http://en.wikipedia.org/wiki/Dolly_zoom http://en.wikipedia.org/wiki/File:Contra-zoom_aka_dolly_zoom_animation.gif Well, you’re right there! Forgive me J-S for briefly forgetting my Cinematography 101 on my last post! I guess what I was referring to was that the behavior was not the same as what I got in Perspective using the TerrainManipulator. I had to deal with the Ortho view area manualy and well as the mouse zoom. And yes I do realize the facts of the behavior of ortho projection. In fact that is why I'm using it in this case - to get a map-like view on a 3D world! I was just hoping (agenst hope) that someone had dealt with this before I - since there are some planview's out there that i heard of that was done in OSG! I guess I'll just have to come up with something to get the mouse to work somewhat the same way it works in Perspective mode! The worse case, I will have to look on how it was done manualy in the old Performer code I have and translate it to a Manipulator some how! Thanks! --- D Glenn D Glenn (a.k.a David Glenn) - Moving Heaven and Earth! -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=35306#35306 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Using TerrainManipulator when the projection matrix is in Ortho mode
Here we go again... :-) On 1/4/2011 10:56 AM, David Glenn wrote: Greetings! I'm experimenting using the a scene graph projected in Ortho mode using the setProjectionMatrixAsOrtho function on the camera and while using the TerrainManipulator on the camera I noticed that the pan is working, but zoom is not! In fact, the only way that I could affect any kind of zoom was to narrow the POV on the camera (that realty is not a zoom). Hi David -- To be precise, changing the FOV _is_ zoom. A zoom lens on a camera changes the FOV to make the image larger or smaller. In fact, in an orthographic projection, changing the FOV is the _only_ way to make the image larger or smaller, as the eye has no distance, only direction. There is no parallax effect in an orthographic projection. I tried to look for any examples but came up short. You should check the archives for discussion of ortho, zoom, and fov. This has been discussed multiple times in the past. Is there any switch or methodology that I missed that can give me an Ortho projection of an otherwise a 3D scene graph? ... Happy New Year All D Glenn D Glenn (a.k.a David Glenn) - Moving Heaven and Earth! -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=35303#35303 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- -Paul Martz Skew Matrix Software http://www.skew-matrix.com/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Using TerrainManipulator when the projection matrix is in Ortho mode
Hi David, I was just hoping (agenst hope) that someone had dealt with this before I - since there are some planview's out there that i heard of that was done in OSG! Well that doesn't mean no one has ever dealt with these issues, just that no one has ever contributed a camera manipulator that did it. They probably did what we did and what I would suggest you do: create a derived class of whatever camera manipulator you want, override the handle() method, check if the event type is a drag with the right mouse button pressed (or whatever other event you want to check for) and do the zoom then. In all other cases just call the base class handle() from your handle() method. As I said, you'll need to pass the camera to your camera manipulator so it can call setProjectionMatrixAsOrtho with modified values at the appropriate time. Hope this helps, J-S -- __ Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com http://www.cm-labs.com/ http://whitestar02.webhop.org/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Using TerrainManipulator when the projection matrix is in Ortho mode
On 1/4/2011 1:14 PM, Jean-Sébastien Guay wrote: Hi David, I was just hoping (agenst hope) that someone had dealt with this before I - since there are some planview's out there that i heard of that was done in OSG! Well that doesn't mean no one has ever dealt with these issues, just that no one has ever contributed a camera manipulator that did it. They probably did what we did and what I would suggest you do: create a derived class of whatever camera manipulator you want, override the handle() method, check if the event type is a drag with the right mouse button pressed (or whatever other event you want to check for) and do the zoom then. In all other cases just call the base class handle() from your handle() method. That's a good solution, and I want to emphasize the or whatever other event you want to check for part. I prefer to have control over both FOV and distance (yes, even in perspective mode), as they clearly produce different results, and sometimes I want one effect and sometimes I want the other. For this reason I recommend against using the right button for FOV. OSG has already set a precedence that this button controls distance. Using right mouse for FOV could be confusing. I usually modify FOV with ctrl right mouse in my code. -- -Paul Martz Skew Matrix Software http://www.skew-matrix.com/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Using TerrainManipulator when the projection matrix is in Ortho mode
Greetings! Sorry all! I didn't mean to open old battle wounds Paul. I was just wondering if anybody else has written anything before I tacked it on my own! Frankly I've never had the chance to look into the logistics of it yet! I just got the command from Mt High that my project has to be Orthographic and I’ve never done anything Orthographic in OSG (outside of a Hud display) before. Thanks for the help! D Glenn D Glenn (a.k.a David Glenn) - Moving Heaven and Earth! -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=35311#35311 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Using TerrainManipulator when the projection matrix is in Ortho mode
Hi Paul, I prefer to have control over both FOV and distance (yes, even in perspective mode), as they clearly produce different results, and sometimes I want one effect and sometimes I want the other. I see your point, but I would say that depends on the expected level of the users of your application, and of course different applications will have different requirements as well. You can even do different things based on the current camera type. The last element of a projection matrix tells you if it's perspective or ortho - mat[3][3] will be 0 or 1 respectively (see http://www.songho.ca/opengl/gl_projectionmatrix.html). So you can have a single camera manipulator that works for any camera (for both projection types), and decide what to do depending on that value if you want. Hope this helps, J-S -- __ Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com http://www.cm-labs.com/ http://whitestar02.webhop.org/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Using TerrainManipulator when the projection matrix is in Ortho mode
Hi, I've made an ortho texture manipulator before for panning and zooming an image. Basically you have to scale the ortho projection before doing any translation/rotation. osg::Matrixd OrthoTextureManipulator::getInverseMatrix() const { return osg::Matrixd::translate(-_center) * osg::Matrixd::translate(-_zoom_offset) * osg::Matrixd::scale(_distance, _distance, 1.0) * osg::Matrixd::translate(_zoom_offset) * osg::Matrixd::rotate(_rotation.inverse()); } This was for a texture in the XY-plane. rgds jp On 05/01/11 00:26, David Glenn wrote: Greetings! Sorry all! I didn't mean to open old battle wounds Paul. I was just wondering if anybody else has written anything before I tacked it on my own! Frankly I've never had the chance to look into the logistics of it yet! I just got the command from Mt High that my project has to be Orthographic and I’ve never done anything Orthographic in OSG (outside of a Hud display) before. Thanks for the help! D Glenn D Glenn (a.k.a David Glenn) - Moving Heaven and Earth! -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=35311#35311 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. MailScanner thanks Transtec Computers for their support. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org