ARCore - 渲染远离相机200米的物体

问题描述 投票:4回答:2

我正在使用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
2个回答
0
投票

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

当Google允许其为ARCore开发人员使用时,我们等待一段时间。


0
投票

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

© www.soinside.com 2019 - 2024. All rights reserved.