I am rendering a large rectangular surface (flattened cube with texture). When the dimensions are more than 10 meters or so the distal part of the surface gets clipped. While researching the topic I found that my problem may have something to do with setting the near and far clipping planes (see: ARCore – Rendering objects 200m far from camera ). How do I set these parameters? Here is how I render the surface:
fun renderImage(arFragment: ArFragment, anchor: Anchor, renderable: Int, width: Float, length: Float, x: Float, y: Float, z: Float, nodeName: String, scale: Float) {
Texture.builder().setSource(BitmapFactory.decodeResource(arFragment.resources, renderable))
.build()
.thenAccept {
MaterialFactory.makeTransparentWithTexture(arFragment.context, it)
.thenAccept { material ->
val modelRenderable = ShapeFactory.makeCube(
Vector3(width, 0.000001f, length),
Vector3(x,y,z), // position
material)
addNodeToScene(arFragment, anchor, modelRenderable, nodeName, scale)
}
}
}
where length=200f; width=100f;
According to answer-0 in the above mentioned post: "at the moment (March 2019) there's no way to setup ARCamera's far clipping plane and near clipping plane." Is this still the case? Could anyone suggest a workaround, please?
I know there is away to get the Projection Matrix (https://developers.google.com/ar/reference/java/arcore/reference/com/google/ar/core/Camera#getProjectionMatrix(float[],%20int,%20float,%20float)). But how do I set it?