【问题标题】:Camera Shaking when using Oculus Rift使用 Oculus Rift 时相机抖动
【发布时间】:2015-01-30 17:46:32
【问题描述】:

我正在使用 oculus 编写应用程序,但相机设置有问题。有时一切正常,相机开始晃动,我们正在查看的模型似乎在抖动。到现在还有人遇到同样的问题吗?

更新相机矩阵的代码如下:

// 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[i].ViewAdjust) );
    view.multLeft(adjust);

    // We use the projection matrices as supplied by the oculus SDK.
    const OSG::Matrix4f &proj = ovr2osg(projection[i]);

    // Finally, set the computed viewing/projection matrices
    camera[i]->setModelviewMatrix(view);
    camera[i]->setProjectionMatrix(proj);
}

OSG::Thread::getCurrentChangeList()->commitChanges();       

【问题讨论】:

    标签: c++ math camera oculus


    【解决方案1】:

    WDM(Windows 桌面管理器)导致了问题。因此,我通过选择 Windows 基本主题禁用了 Aero,但它并没有解决我的问题。所以,我必须调用DwmEnableComposition(DWM_EC_DISABLECOMPOSITION) 来禁用 DWM 组合,然后不会发生抖动。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-10
      • 2017-06-10
      • 1970-01-01
      相关资源
      最近更新 更多