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?
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.
To setup your objects' visibility properly just use the following recommendation that you can find HERE and HERE.
To know more about
frustum culling
read this useful article.
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.