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
756 stars 151 forks source link

Correct way to set background color/ using skybox causes black flash momentarily #455

Closed tomriddle25 closed 1 month ago

tomriddle25 commented 3 months ago

Hi folks, first of all thanks a lot for building and maintaining SceneView, its been a boon for 3d model viewing on a jetpack compose project.

My problem is that the models I am using do not have a background, and are displayed with a black background, and when I am trying to use the existing solutions discussed on issues like a colored skybox , I am getting a black background initially when the composable is rendered and then it becomes white. Its sort of like a black flash.

Scene(
    modifier = Modifier
        .fillMaxSize()
        .background(Color.WHITE),
    engine = engine,
    modelLoader = modelLoader,
    cameraNode = cameraNode,
    childNodes =
    listOf(centerNode,
        rememberNode {
            ModelNode(
                modelInstance = modelLoader.createModelInstance("avatar/compressed_new/St2.glb"),
            )
        }),
    onViewCreated = {
        skybox = Skybox.Builder().color(255f, 255f, 255f, 1.0f).build(this.engine)
    }
)

Here's a video of the issue.

https://github.com/SceneView/sceneview-android/assets/17904436/e8f8b837-9bb6-488d-ae00-99995403af4e

P.S. - I am using the latest release 2.1.0.