将物体放置在人上方30米处 [英] Placing an object 30 meters above a person

查看:103
本文介绍了将物体放置在人上方30米处的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以将物体放置在高30或50米的人上方?

Is it possible to place an object right above a person that is 30 or 50 meters higher?

当我尝试放置链接到锚点的对象时,它在20米内可见,而在40米内不可见?

When I try to place an object linked to anchor it is visible in 20 meters and not visible in 40 meters?

为什么会发生这种情况,我该如何配置?

Why this happens and how can I configure this?

推荐答案

这是ARCore中的frustum culling问题–不在视锥台可见区域内的对象将不会被渲染.通常,Android设备中的FoV(视场)在水平方向上约为60度(垂直光圈取决于纵横比). Viewing frustum culling是从渲染过程中删除完全位于视锥范围之外的对象的过程,从而显着减少了CPU和GPU的计算负担.并且不要忘记,近和远修剪平面也是视锥的一部分.

It is frustum culling issue in ARCore – objects that aren't within the viewable area of camera frustum won't be rendered. Typically FoV (field of view) in Android devices is around 60 degrees horizontally (vertical aperture depends on aspect ratio). Viewing frustum culling is the process of removing objects that lie completely outside the viewing frustum from the rendering process, thus significantly decreasing CPU's and GPU's computational burden. And don't forget that near and far clipping planes are also parts of frustum.

要正确设置对象的可见性,请使用以下建议,您可以找到此处.

要了解有关frustum culling的更多信息,请阅读

To know more about frustum culling read this useful article.

要返回用于渲染内容的投影矩阵,请使用以下java方法:

For returning a projection matrix for rendering content use the following java method:

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

我可以在MainActivity.java文件中以这种方式使用它:

I can use it this way in MainActivity.java file:

// Getting Projection Matrix
float[] projectionMtx = new float[16];
arSession.getProjectionMatrix(projectionMtx, 0, 0.5f, 201.0f);

// Setting Projection Matrix
arRenderer.setProjectionMatrix(projectionMtx);

...或在MainActivity.kt文件中以这种方式:

...or this way in MainActivity.kt file:

// Getting Projection Matrix
private fun computeProjectionMatrix(): FloatArray {
    val projectionMtx = FloatArray(16)
    session.getProjectionMatrix(projectionMtx, 0, 0.5f, 201.0f)
    return projectionMtx
}

// Setting Projection Matrix
renderer.setProjectionMatrix(computeProjectionMatrix())

希望这会有所帮助.

这篇关于将物体放置在人上方30米处的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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