Re: [osg-users] How to set camera focal length

2010-12-12 Thread Mat Zanis
Test -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=34666#34666 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Re: [osg-users] How to set camera focal length

2010-12-10 Thread Jean-Sébastien Guay
Hi Igor, Yes, just found out the view matrix was wrong and the image was black because the camera was inside some object or something, and i first thought i am reading from a wrong buffer. Glad to know you found the problem. Sorry guys for bothering you with such simple stuff. It's not b

Re: [osg-users] How to set camera focal length

2010-12-10 Thread Igor Galochkin
Skylark wrote: > > Most likely your view matrix calculation has an error. > Yes, just found out the view matrix was wrong and the image was black because the camera was inside some object or something, and i first thought i am reading from a wrong buffer. Sorry guys for bothering you with s

Re: [osg-users] How to set camera focal length

2010-12-10 Thread Jean-Sébastien Guay
Hello Igor, So, at each frame the camera's matrix is overwritten by a new matrix which is taken from MatrixManipulator. In the past few hours two people on this list told you that if you wanted to use your own view matrix you needed to set no camera manipulator... (Paul Martz and Mourad Bou

Re: [osg-users] How to set camera focal length

2010-12-10 Thread Igor Galochkin
just found where the problem is: Viewer.cpp, line 1023: inside viewer.updateTraversals if (_cameraManipulator.valid()) { setFusionDistance( getCameraManipulator()->getFusionDistanceMode(), getCameraManipulator()->getFusionDistanceValue() ); _came

Re: [osg-users] How to set camera focal length

2010-12-10 Thread Mourad Boufarguine
Hi Igor, > But i still can't set up the position and rotation of the viewer's camera. > > > this->_viewer.getCamera()->setReferenceFrame(::osg::Transform::ABSOLUTE_RF); > this->_viewer.getCamera()->setViewMatrix(::osg::Matrix::translate(0.5, 0.3, > 0.1)); > > this does nothing. > > My guess is be

Re: [osg-users] How to set camera focal length

2010-12-09 Thread David Glenn
Greetings! Just in case or just for grins, I found this page on simulating Depth of Field: http://screamyguy.net/DepthOfField/index.htm as far as focal length, there is many calculations that you can use for OpenGL - check out some of the gaming jernals! That's my two cents worth! I think all

Re: [osg-users] How to set camera focal length

2010-12-09 Thread Paul Martz
On 12/9/2010 9:35 AM, Igor Galochkin wrote: Thanks for help! I am setting the focal lense x and y with the following calls now and it seems to work fine: double fovy = 2 * atan(this->_height / 2.0 / dFocalLengthY); double aspectRatio = this->_nWidth / this->_nHeight * dFocalLengthY / dFocalL

Re: [osg-users] How to set camera focal length

2010-12-09 Thread Igor Galochkin
Thanks for help! I am setting the focal lense x and y with the following calls now and it seems to work fine: double fovy = 2 * atan(this->_height / 2.0 / dFocalLengthY); double aspectRatio = this->_nWidth / this->_nHeight * dFocalLengthY / dFocalLengthX; double zNear = 0.1, zFar = 100.0; _vi

Re: [osg-users] How to set camera focal length

2010-12-09 Thread Robert Osfield
Hi Igor On Thu, Dec 9, 2010 at 11:03 AM, Igor Galochkin wrote: > Under Focal length I mean the distance from the camera's lens to it's focus. > This distance can be different for x and y, for example, if the camera's lens > is oval in shape. > > I have to write a function which receives, among

Re: [osg-users] How to set camera focal length

2010-12-09 Thread Mourad Boufarguine
Hi Igor, Take a look at this website : http://old.uvr.gist.ac.kr/wlee/web/techReports/ar/Camera%20Models.html you can find how to compute the projection matrix parameters of an opengl camera (fovy and aspect ratio) out of a real camera intrinsic parameters (focal lengths and focal point). Mour

Re: [osg-users] How to set camera focal length

2010-12-09 Thread Igor Galochkin
[quote="robertosfield"]HI Igor, an osg::Camera nor GL camera don't have a concept of a focal length. [quote] Under Focal length I mean the distance from the camera's lens to it's focus. This distance can be different for x and y, for example, if the camera's lens is oval in shape. I have to

Re: [osg-users] How to set camera focal length

2010-12-09 Thread Robert Osfield
HI Igor, I believe you are getting your terms mixed up. Focal length is not something that varies for X and Y axis of camera, and an osg::Camera no GL camera don't have a concept of a focal length. If you are doing depth of field rendering technique then field of view would be relevant, but it r

[osg-users] How to set camera focal length

2010-12-09 Thread Igor Galochkin
Hi, Just to understand how setProjectionMatrix works, say, I need to set X-Focal length of viewer's camera to 1000 and Y-Focal length to 600. Also i need the Camera to be translated by x by 0.5 to the right and y by 0.7 down. What matrix m should i pass to viewer.getCamera()->setProjection(m) t