ARCore – 渲染距离相机 200m 的物体

Olg*_*eva 5 java augmented-reality kotlin arcore sceneform

我正在使用 ARCore 和 Sceneform 开发 Android AR 项目。我需要把对象从30米200米远从用户的摄像头和面临的视锥剔除在ARCORE问题,说明这里

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

public void getProjectionMatrix (float[] dest, 
                                 int offset, 
                                 float near, 
                                 float far);
Run Code Online (Sandbox Code Playgroud)

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

这是我的代码:

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  
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

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

请建议我是否可以通过其他方式做到这一点?如果不是,那么对用户可见的远处放置对象的最佳方法是什么?

先感谢您。

ARG*_*Geo 0

无法在 ARCore 本身中设置 ARCamerafar clipping planenear clipping planeARCore。您只能在当前的渲染框架中使用相应的设置来执行此操作(Google Sceneform 已正式弃用,还记得吗?)。