【问题标题】:ARCore – Rendering objects 200m far from cameraARCore – 渲染距离相机 200m 的物体
【发布时间】:2019-07-22 10:11:32
【问题描述】:

我正在使用 ARCore 和 Sceneform 开发 Android AR 项目。我需要将对象放置在距离用户相机 30 米到 200 米远 的地方,并面临 ArCore 中的 截锥体剔除 问题,描述为 HERE

我正在尝试设置投影矩阵以使用此方法增加far参数

public void getProjectionMatrix (float[] dest, 
                                 int offset, 
                                 float near, 
                                 float far);

但我找不到设置渲染投影矩阵的可能性。

这是我的代码:

arFragment.arSceneView.apply {
    scene.addOnUpdateListener {
        // Some code to return from this callback if arFrame is not initialised yet
        if (!objectsAdded) {
            placeObject(Pose.makeTranslation(0f, 100f, 100f), this)
            objectsAdded = true
            scene.camera.projectionMatrix = Matrix(computeProjectionMatrix(frame.camera))
            // P.S. frame.camera is ArCore's camera, scene.camera is Sceneform's one.
            // So, I'm not sure that using them in such way is consistent  
        }
    }
}

setProjectionMatrix 方法包含注解VisibleForTesting。所以,我不确定我是否应该使用它,并且可以保证它会起作用。

请问我是否可以通过其他方式做到这一点? 如果不是,那么让用户看到远处物体的最佳方法是什么?

提前谢谢你。

【问题讨论】:

标签: java kotlin augmented-reality arcore sceneform


【解决方案1】:

使用 Sceneform,您可以像这样设置远剪辑平面:arFragment.getArSceneView().getScene().getCamera().setFarClipPlane(…);

【讨论】:

  • 这应该是选择的答案
【解决方案2】:

经过彻底调查,我发现目前(2019 年 3 月)无法设置 ARCamera 的 far clipping planenear clipping plane

让我们等待 Google 允许 ARCore 开发人员使用它

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-09-08
    • 2017-09-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-10
    相关资源
    最近更新 更多