问题描述
是否可以将物体放在 30 或 50 米高的人的正上方?
当我尝试放置链接到锚点的对象时,它在 20 米内可见而在 40 米内不可见?
为什么会发生这种情况,我该如何配置?
这是 ARCore 中的视锥剔除
问题——不在相机视锥可视区域内的对象将不会被渲染.通常,Android 设备中的 FoV
(视野)在水平方向约为 60 度(垂直光圈取决于纵横比).视锥体剔除
是从渲染过程中移除完全位于视锥体之外的对象的过程,从而显着降低 CPU 和 GPU 的计算负担.并且不要忘记近剪裁平面和远剪裁平面也是截锥体的一部分.
要正确设置对象的可见性,只需使用以下建议,您可以找到
要了解有关 frustum culling
的更多信息,请阅读 这篇有用的文章.
要返回用于渲染内容的投影矩阵,请使用以下 java 方法:
public void getProjectionMatrix (float[] dest,整数偏移,飘近,飘远);
我可以在MainActivity.java
文件中这样使用它:
//获取投影矩阵浮动[]投影Mtx =新浮动[16];arSession.getProjectionMatrix(projectionMtx, 0, 0.5f, 201.0f);//设置投影矩阵arRenderer.setProjectionMatrix(projectionMtx);
...或者在 MainActivity.kt
文件中这样:
//获取投影矩阵私人乐趣 computeProjectionMatrix(): FloatArray {val 投影Mtx = FloatArray(16)session.getProjectionMatrix(projectionMtx, 0, 0.5f, 201.0f)返回投影Mtx}//设置投影矩阵renderer.setProjectionMatrix(computeProjectionMatrix())
希望这会有所帮助.
Is it possible to place an object right above a person that is 30 or 50 meters higher?
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?
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.
For returning a projection matrix for rendering content use the following java method:
public void getProjectionMatrix (float[] dest,
int offset,
float near,
float far);
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);
...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())
Hope this helps.
这篇关于将物体放置在人上方 30 米处的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!