ARCore –渲染距离相机200m的物体 [英] ARCore – Rendering objects 200m far from camera

查看:225
本文介绍了ARCore –渲染距离相机200m的物体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用ARCore和Sceneform进行Android AR项目.我需要将物体放置在距用户相机30米到200米远的地方,并面对ArCore中的截锥体剔除问题,

I'm working on Android AR project using ARCore and Sceneform. I need to place the objects from 30 meters to 200 meters far from user's camera and faced with the frustum culling issue in ArCore, described HERE.

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

I'm trying to set projection matrix to increase the far parameter using this method

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

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

But I can't find possibility to set the rendering projection matrix.

这是我的代码:

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.因此,我不确定是否应该使用它,并且可以保证它会起作用.

setProjectionMatrix method contains annotation VisibleForTesting. So, I'm not sure if I should use it and there is a guarantee that it will work.

请告知我是否可以通过其他方式进行操作? 如果没有,那么对用户可见的放置远处对象的最佳方法是什么?

Please, advice if I can do it in some other way? If no, what the best way to do far placed objects visible for user?

谢谢.

推荐答案

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

当Google允许ARCore开发人员使用它时,请等待一段时间. .

Let's wait for a while when Google allows it for ARCore developers.

这篇关于ARCore –渲染距离相机200m的物体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆