02-01-2015 05:54 AM
Hi,
I am writing an application with oculus rift dk2, which the user wants to move around an object by using a controller and head movement to see the object from different views. Everything is working fine till now just sometimes, it seems the camera is start shaking and the model which we are looking at seems jittering. Anyone has the same problem till now?
The code to update the camera matrix is as follows:
// Concatentaion of both the given navigator and the position tracking
OSG::Matrix4f m;
// If a navigator is given, we attach to it
if (navigator) {
m = navigator->getMatrix();
}
// apply position/rotation as obtained from tracking
OSG::Matrix4f trans;
trans.setTranslate(ovr2osg(headPose.Position));
trans.setRotate(ovr2osg(headPose.Orientation));
m.mult(trans);
// compute modelview matrix for player
OSG::Matrix4f modelview;
player->setMatrix(m);
playerNode->getToWorld(modelview);
modelview.invert();
for (int i = 0; i < ovrEye_Count; ++i) {
// The player node acts as the beacon for our stereo setup.
// Basd on the modelview matrix of the player, we
// now compute the viewing matrix for each eye, which
// basically corresponds a small shift to account for eye separation.
OSG::Matrix4f view(modelview);
// The overall shift is determined by the IPD (Interpupillary
// distance): To account for the IPD we just translate the viewing
// matrix by the viewing adjust vector as reported by the oculus SDK.
// NOTE: The Left-handed (!) multiplication is crucial
const OSG::Matrix4f &adjust = ovr2osg( OVR::Matrix4f::Translation(eyeRenderDesc.ViewAdjust) );
view.multLeft(adjust);
// We use the projection matrices as supplied by the oculus SDK.
const OSG::Matrix4f &proj = ovr2osg(projection);
// Finally, set the computed viewing/projection matrices
camera->setModelviewMatrix(view);
camera->setProjectionMatrix(proj);
}
OSG::Thread::getCurrentChangeList()->commitChanges();
Solved! Go to Solution.
02-02-2015 04:37 AM
See :
https://answers.oculus.com/questions/37/what-causes-judder-and-how-can-i-fix-it.html
You should monitor you framerate. You will probably find that you are dropping frames when you see the jitter.
02-02-2015 04:37 AM
See :
https://answers.oculus.com/questions/37/what-causes-judder-and-how-can-i-fix-it.html
You should monitor you framerate. You will probably find that you are dropping frames when you see the jitter.