Hello, I am using a osg::CameraView to make a "first person view". The CameraView is attached to a osg::PositionAttitudeTransform node (we will call this node "Head"). I can't understand why, but when I tilt the "head", the camera's Znear, and Zfar value's change...
I create my CameraView in this way : Code: m_viewSimulation = new CameraView; m_viewSimulation->setPosition(Vec3f(0,-.01,0)); m_viewSimulation->setFieldOfView(45.); m_viewSimulation->setFieldOfViewMode(CameraView::VERTICAL); m_viewSimulation->setFocalLength(0.); m_tiltableHead->addChild(m_viewSimulation); Then a CameraViewSwitchManipulator is created to choose wich of all my cameraview will be the camera's node. Tilting the head is done in this way : Code: Quat cameraAttitude; cameraAttitude.makeRotate(PI, Vec3f(0.,0.,1.), _tilt, Vec3f(1.,0.,0.), 0, Vec3f(0,1,0)); m_tiltableHead->setAttitude(cameraAttitude); m_camera->setProjectionMatrixAsPerspective(60., 1., 0.01, 1000.); Note that I set the projection matrix with a Znear and Zfar each time the head is tilted. Then I get the projection matrix thanks to these lines before, and after the call to Viewer::frame : Code: double fovy, ratio, near, far; m_viewer.getCamera()->getProjectionMatrixAsPerspective(fovy, ratio, near, far); cout << "Before :Camera Frustum : FOV Y" <<fovy<<", ratio : "<<ratio<<", near :"<<near <<", far :" << far<< endl; m_viewer.frame(); m_viewer.getCamera()->getProjectionMatrixAsPerspective(fovy, ratio, near, far); cout << "After :Camera Frustum : FOV Y" <<fovy<<", ratio : "<<ratio<<", near :"<<near <<", far :" << far<< endl; When I run my application, I can see that the cameraview is moving like the node "TiltableHead", but Znear and Zfar envolve too, look at the console result of the "cout" : Code: Before :Camera Frustum : FOV Y60, ratio : 1, near :0.01, far :1000 After :Camera Frustum : FOV Y60, ratio : 1, near :2.26244, far :4615.38 Before :Camera Frustum : FOV Y60, ratio : 1, near :0.01, far :1000 After :Camera Frustum : FOV Y60, ratio : 1, near :2.26716, far :4625 Before :Camera Frustum : FOV Y60, ratio : 1, near :0.01, far :1000 After :Camera Frustum : FOV Y60, ratio : 1, near :2.27232, far :4635.54 Before :Camera Frustum : FOV Y60, ratio : 1, near :0.01, far :1000 After :Camera Frustum : FOV Y60, ratio : 1, near :2.2779, far :4646.92 Before :Camera Frustum : FOV Y60, ratio : 1, near :0.01, far :1000 After :Camera Frustum : FOV Y60, ratio : 1, near :2.284, far :4659.36 Before :Camera Frustum : FOV Y60, ratio : 1, near :0.01, far :1000 After :Camera Frustum : FOV Y60, ratio : 1, near :2.29092, far :4673.47 Before :Camera Frustum : FOV Y60, ratio : 1, near :0.01, far :1000 After :Camera Frustum : FOV Y60, ratio : 1, near :2.2976, far :4687.11 Before :Camera Frustum : FOV Y60, ratio : 1, near :0.01, far :1000 After :Camera Frustum : FOV Y60, ratio : 1, near :2.30406, far :4700.29 Before :Camera Frustum : FOV Y60, ratio : 1, near :0.01, far :1000 After :Camera Frustum : FOV Y60, ratio : 1, near :2.31029, far :4712.99 Before :Camera Frustum : FOV Y60, ratio : 1, near :0.01, far :1000 After :Camera Frustum : FOV Y60, ratio : 1, near :2.31629, far :4725.22 Before :Camera Frustum : FOV Y60, ratio : 1, near :0.01, far :1000 So Why does viewer::Frame change Znear and Zfar ??? Cheers, Adrien ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=32549#32549 _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

