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

Issue with lighting #235

Closed Methew5 closed 2 years ago

Methew5 commented 2 years ago

Hi. I tried to use two options of LightEstimationConfig: Spectacular & Disabled. In two cases I faced a problem: 1)Spectacular: when moving away, the model becomes darker https://user-images.githubusercontent.com/69910337/145591863-d3eeb7fc-9d99-4814-b3b1-7219164da1a9.mp4 2)Disabled: on different walls, I have different colors of the model https://user-images.githubusercontent.com/69910337/145591838-2c8350df-48ea-449b-839a-d372768a516e.mp4 @ThomasGorisse, or someone else, do you know, how can I fix that? Is it possible?

ThomasGorisse commented 2 years ago

Hi @Methew5 ,

Welcome to the light estimation world.

1)Spectacular: when moving away, the model becomes darker https://user-images.githubusercontent.com/69910337/145591863-d3eeb7fc-9d99-4814-b3b1-7219164da1a9.mp4

This is a "normal" behavior since your room seems very dark. ARCore is updating the estimation while you go backward from the wall. It first (when only seeing a white wall and nothing else) think it's a quite lighted room but estimate it more precisely when you give it more infos about the real environment (backing ward from the wall and seeing more dark things around) LightEstimationConfig.SPECTACULAR vs LightEstimationConfig.REALISTIC mostly differs on the reflections parts and you will mainly only see differences if your model has more metallic than roughness material values. Adjust the based reference/factored lighting values with:

sceneView.mainLight.intensity

and

sceneView.environment.indirectLight.intensity

2)Disabled: on different walls, I have different colors of the model https://user-images.githubusercontent.com/69910337/145591838-2c8350df-48ea-449b-839a-d372768a516e.mp4

This can be due to 2 things I think:

That being said, you can act on multiple things moreover then just modifying the LightEstimationConfig mode:

https://github.com/SceneView/sceneform-android/blob/c4ed1ba1b717ec3142e1335f623cc80cf838466f/core/src/main/java/com/gorisse/thomas/sceneform/light/LightEstimation.kt#L39-L96

Finally, have a look at the sample app for adjusting your desired values: Get it on Google Play

Methew5 commented 2 years ago

@ThomasGorisse, thank you for your advice and time. First of all, I consider the Spectacular config. I have already tried all HDR options, created different custom configs, but it didn't help. Increasing indirect light intensity leads to a very bright model when the room is lit well. Changing the main light intensity gives nothing. But overall, the Spectacular config gives good results. Thank you very much again, I really appreciate your work.