SceneView / sceneform-android

Sceneform Maintained is an ARCore Android SDK with Google Filament as 3D engine. This is the continuation of the archived Sceneform
https://sceneview.github.io/sceneform-android/
Apache License 2.0
627 stars 147 forks source link

.glb models mostly has no textures rendered on the scene #222

Closed skustra closed 2 years ago

skustra commented 2 years ago

Im using: implementation("com.gorisse.thomas.sceneform:sceneform:1.20.2")

building .glb model:

: CompletableFuture<ModelRenderable>? {
        return ModelRenderable.builder()
            .setSource(
                context,
                Uri.parse(modelPath)
            )
            .setIsFilamentGltf(true)
            .setAsyncLoadEnabled(false)
            .build()
    }

waiting for the result:

getModelRenderable(
                            arFile.fileId,
                            arFile.fileExtension
                        )?.thenAccept { characterModel ->...})

placing model on on the scene:

 scene.addChild(AnchorNode(hitResult?.createAnchor()).apply {
            addChild(TransformableNode(arFragment.transformationSystem).apply {
                renderable = marker.getModelRenderable()
                renderableInstance.animate(true)
                    .start()
            })
        })

I have the same results with dragon.glb, cube.glb, etc. Your sample working just fine. I have no idea whats the problem is really, could You please take a look at this one? Some of the texture are visible, but rest of them not.

Thank you!

image

The code is based on **ar-model-viewer**

skustra commented 2 years ago

Could I miss some lighting settings maybe?

ThomasGorisse commented 2 years ago

Can you please install AR Environment Lights? And give the light estimations values you have.

skustra commented 2 years ago

@ThomasGorisse image

skustra commented 2 years ago

image

ThomasGorisse commented 2 years ago

image Values seems correct. Please add a model to the screenshot.

skustra commented 2 years ago

image

ThomasGorisse commented 2 years ago

So the app is working well on your phone. I think I know where your issue is coming from. Are you using the ArSceneView directly (not the ArFragment)?

skustra commented 2 years ago

I have Fragment A with has ArFragment inside XML FragmentContainerView with extends BaseArFragment

skustra commented 2 years ago

After I set the:

  this.arSceneView.lightEstimationConfig = LightEstimationConfig(Config.LightEstimationMode.DISABLED)

I'm able to see textures but without a camera preview :D

skustra commented 2 years ago

image

ThomasGorisse commented 2 years ago

Java:

ArSceneViewKt.setLightEstimationConfig(arSceneView, LightEstimationConfig.REALISTIC);

Kotlin:

arSceneView.lightEstimationConfig = LightEstimationConfig.REALISTIC

Doc:

/**
 * ### ARCore light estimation configuration
 *
 * ARCore estimate lighting to provide directional light, ambient spherical harmonics,
 * and reflection cubemap estimation
 *
 * Light bounces off of surfaces differently depending on whether the surface has specular
 * (highly reflective) or diffuse (not reflective) properties.
 * For example, a metallic ball will be highly specular and reflect its environment, while
 * another ball painted a dull matte gray will be diffuse. Most real-world objects have a
 * combination of these properties — think of a scuffed-up bowling ball or a well-used credit
 * card.
 *
 * Reflective surfaces also pick up colors from the ambient environment. The coloring of an
 * object can be directly affected by the coloring of its environment. For example, a white ball
 * in a blue room will take on a bluish hue.
 *
 * The main directional light API calculates the direction and intensity of the scene's
 * main light source. This information allows virtual objects in your scene to show reasonably
 * positioned specular highlights, and to cast shadows in a direction consistent with other
 * visible real objects.
 *
 * @see LightEstimationConfig.REALISTIC
 * @see LightEstimationConfig.SPECTACULAR
 * @see LightEstimationConfig.AMBIENT_INTENSITY
 */

Added doc : https://github.com/SceneView/sceneform-android#environment-lights

skustra commented 2 years ago

@ThomasGorisse I made a video. The first one is the default one. After that, I'm changing the light every 5 seconds :D

It's working! Thanks for your help and for your work!

https://user-images.githubusercontent.com/83349532/144654379-a4476baf-8a22-45aa-8088-4f5e3fc7384b.mp4

<3

ThomasGorisse commented 2 years ago

That's because the default value is applied on the ArFragment not BaseArFragment.

ThomasGorisse commented 2 years ago

Thanks for the nice Video shots.

@skustra What tool are you using to make your screen record and to make it less then 10Mb?

skustra commented 2 years ago

Thanks for the nice Video shots.

@skustra What tool are you using to make your screen record and to make it less than 10Mb?

I used a native Samsung s21 screen recorder then sent it to the Telegram app (Telegram has optimized it I believe so)