【问题标题】:Where in this example does the google vr apply binocular distortion?在这个例子中,google vr 在哪里应用了双目失真?
【发布时间】:2016-10-26 22:55:11
【问题描述】:

我正在为谷歌纸板开发一个应用程序,它将流式传输两个视频,每只眼睛一个,以模拟 3D 视觉。我只打算使用 google vr sdk 来模拟将应用于每一帧的双目畸变,但是从this example 不清楚哪个函数实际应用了畸变。

/**
 * Draws a frame for an eye.
 *
 * @param eye The eye to render. Includes all required transformations.
 */
@Override
public void onDrawEye(Eye eye) {
    GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);
    ...
    // Apply the eye transformation to the camera.
    Matrix.multiplyMM(mView, 0, eye.getEyeView(), 0, mCamera, 0);

    // Set the position of the light
    Matrix.multiplyMV(mLightPosInEyeSpace, 0, mView, 0, LIGHT_POS_IN_WORLD_SPACE, 0);

    // Build the ModelView and ModelViewProjection matrices
    // for calculating cube position and light.
    float[] perspective = eye.getPerspective(Z_NEAR, Z_FAR);
    Matrix.multiplyMM(mModelView, 0, mView, 0, mModelCube, 0);
    Matrix.multiplyMM(mModelViewProjection, 0, perspective, 0, mModelView, 0);
    drawCube();

    // Draw the rest of the scene.
    ...
}

这段代码sn-p是这样描述的:

这是事件的顺序:

  • 宝物进入眼界。
  • 我们应用投影矩阵。这提供了为指定眼睛渲染的场景。
  • Google VR SDK 会自动应用失真来渲染最终场景。

然而,这第三步实际上并没有被解释。由于我不是渲染和图像,只是使用现实生活中的视频,我只需要使用应用失真的代码部分,但我不清楚这是如何发生的。

如果有人有任何想法,请告诉我。

【问题讨论】:

    标签: android rendering virtual-reality google-vr


    【解决方案1】:

    public Distortion getApproximateInverseDistortion (float maxRadius, int numCoefficients)

    使用最小二乘拟合系数构建反失真对象。

    这旨在实现应用程序端自定义失真。在返回的对象上使用 .getCoefficients() 来检索逆失真函数的系数。

    这是一个近似的逆,在返回的对象上使用 .distort() 会比在原始对象上使用 distortInverse() 方法更快但不太准确。为了获得有用的结果,输入失真必须在 0..maxRadius 范围内表现良好。

    以 50 度半角 FOV(总共 100 度)为例,这将创建一个反向失真,其中 inverse.distort(r) 大约等于 r = 0 ... maxFovHalfAngle 范围内的distortion.distortInverse(r)。

    更多信息:https://developers.google.com/vr/android/reference/com/google/vr/sdk/base/Distortion

    https://www.baekdal.com/insights/why-pretty-much-all-360-vr-videos-get-it-wrong

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-03-16
      • 1970-01-01
      • 1970-01-01
      • 2010-10-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多