SceneView / sceneview-android

SceneView is a 3D and AR Android Composable and View with Google Filament and ARCore. This is a Sceneform replacement in Kotlin
Apache License 2.0
850 stars 161 forks source link

Detecting vertical walls, dosent work. #54

Closed CapelaA10 closed 2 years ago

CapelaA10 commented 2 years ago

Hey.

Doing the implementation we found out that ARCore whitout sceneview is able to detect vertical walls with just one color. Like in the example by google hello_ar_java, that is working.

But with sceneview that was not the case. Changing the config from HORIZONTAL_VERTICAL or just VERTICAL in the plane finding mode, doesn't make a difference.

We know that it's possible and we see a lot of "default" implementations of ArCore doing this. This is an issue? This will be fixed? What can we expect SceneView to do about this?

grassydragon commented 2 years ago

Hi! Are you using the latest version of SceneView? There shouldn't be any differences in the plane detection but there can be some issues with the plane rendering.

CapelaA10 commented 2 years ago

Hey @grassydragon, yes we are using the last java version because of augmented faces support, should this make a difference? There is a post opened on the java one: https://github.com/SceneView/sceneform-android/issues/349

And what are the issues about the plane rendering and how can we work around them?

grassydragon commented 2 years ago

Hey @grassydragon, yes we are using the last java version because of augmented faces support, should this make a difference?

Yes, the issues with the plane rendering appeared in SceneView after the refactoring and were fixed in the latest version.

And what are the issues about the plane rendering and how can we work around them?

Sceneform should be free from these issues. Can you provide the screenshots that demonstrate how Sceneform is detecting the vertical planes versus other applications (in the Sceneform repository)?

Please use only the corresponding repository for creating issues in future.

CapelaA10 commented 2 years ago

@grassydragon alright, thanks. Tomorrow first thing we will provide screen recordings and screenshots about this issue in the Java repository so if you can check it tomorrow we will appreciated.

Btw thanks a lot for the fast response and job maintaining sceneview :D

hlefe commented 2 days ago

Hello, Using configureSession after creating ARSceneView doesn't seem to work:

sceneview.apply {  
    configureSession { session, config ->  
        config.planeFindingMode = Config.PlaneFindingMode.VERTICAL  
    }  
}

(With the code above, ARCore doesn't seem to apply the configuration change.)

➡️ Instead, you need to set Config.PlaneFindingMode.VERTICAL during initialization like this:

sceneView = ARSceneView(  
    viewContext,  
    sharedLifecycle = lifecycle,  
    sessionConfiguration = { session, config ->  
        config.apply { planeFindingMode = Config.PlaneFindingMode.VERTICAL }  
    }  
)

💡 If you want to change the configuration after initialization, you need to do it like this:

sceneView.session?.let { session ->  
    session.configure(session.config.apply {  
        planeFindingMode = Config.PlaneFindingMode.VERTICAL  
    })  
}

⚠️ And one last thing to make it work: you need to set the planeRendererMode like this (otherwise, vertical planes won't be displayed):

sceneView.apply {  
    planeRenderer.isEnabled = true  
    planeRenderer.isVisible = true  
    planeRenderer.planeRendererMode = PlaneRenderer.PlaneRendererMode.RENDER_ALL  
}

You can find my complete code here if it might help you: https://github.com/hlefe/ar_flutter_plugin_flutterflow/blob/sceneview-android/android/src/main/kotlin/io/carius/lars/ar_flutter_plugin_flutterflow/ArView.kt