ARCore – Rendering objects 200m far from camera
Asked Answered
C

2

5

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.

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.

Here is my code:

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 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?

Thank you in advance.

Columbia answered 28/2, 2019 at 13:16 Comment(1)
Not really supported according to this: github.com/google-ar/sceneform-android-sdk/issues/498Carbonous
S
0

There's no way to setup ARCamera's far clipping plane and near clipping plane in ARCore itself. You can only do it in your current rendering framework (Google Sceneform is officially deprecated, remember?) using corresponding settings.

Supersensible answered 3/3, 2019 at 13:31 Comment(0)
T
2

Using Sceneform, you can set the far clip plane like this: arFragment.getArSceneView().getScene().getCamera().setFarClipPlane(…);

Telemechanics answered 3/5, 2019 at 10:7 Comment(1)
this should be the selected answerIlka
S
0

There's no way to setup ARCamera's far clipping plane and near clipping plane in ARCore itself. You can only do it in your current rendering framework (Google Sceneform is officially deprecated, remember?) using corresponding settings.

Supersensible answered 3/3, 2019 at 13:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.