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
633 stars 146 forks source link

phone surface turns out to be black #315

Closed chenleicrm closed 1 year ago

chenleicrm commented 2 years ago

Screenshot_20220218-104636_SceneFormDemo As you can see. Phone modal surface is black when I use REALISTIC or SPECTACULAR config Screenshot_20220218-105430_SceneFormDemo And phone modal surface turns out to be oranged when I use DISABLED mode

chenleicrm commented 2 years ago

I wonna to know why the phone is oranged and how to disable

chenleicrm commented 2 years ago

maldives_blue.zip the glb file is in the zip above

ThomasGorisse commented 2 years ago

Hi, Can you confirm that you also don't see the screen with AMBIENT_INTENSITY? Can you send a screenshot of your model screen material within Blender?

ThomasGorisse commented 2 years ago

If well defined, the phone screen should be emissive to work in real (AR) usage.

chenleicrm commented 2 years ago

Hi, Can you confirm that you also don't see the screen with AMBIENT_INTENSITY? Can you send a screenshot of your model screen material within Blender?

WX20220219-172313@2x

here is the screenshot of the model screen and you can also see the glb file in maldives_blue.zip above

chenleicrm commented 2 years ago

I can see the model screen but need to rotate the modal or put it on the desk not on the floor when i open the light estimate

chenleicrm commented 2 years ago

If well defined, the phone screen should be emissive to work in real (AR) usage.

I just use the model view demo code and replace the model file

ThomasGorisse commented 2 years ago

If well defined, the phone screen should be emissive to work in real (AR) usage.

I just use the model view demo code and replace the model file

I meant change the emissive from Blender. As we can see in your Blender screenshot, the phone screen doesn't seems to emit lights. So just like in real world, if your phone screen is "turned off" nothing will be "visible"

chenleicrm commented 2 years ago

Is this model emiting light ?

WX20220219-174924@2x
chenleicrm commented 2 years ago

If well defined, the phone screen should be emissive to work in real (AR) usage.

I just use the model view demo code and replace the model file

I meant change the emissive from Blender. As we can see in your Blender screenshot, the phone screen doesn't seems to emit lights. So just like in real world, if your phone screen is "turned off" nothing will be "visible"

but when i rotate the modal to the direction of light , i can see the phone screen...

chenleicrm commented 2 years ago

Do you mean the phone screen is not emit light , so the screen is "turn off", when i rotate the model screen to the light . it can "turn on" ?

ThomasGorisse commented 2 years ago

Is this model emiting light ?

Your model material is made of a single linear image texture so you have to modify it properties inside Blender if you want your screen to be lighter and emissive and keep the rest as a standard phone material.

ThomasGorisse commented 2 years ago

This is your texture image To explain you shortly what is happening, just imagine what would happen in real life if you printed the bellow image on a paper and paste it on something having the same shape as a phone. If your room is a even a little dark, you won't see it well because it won't have any reflections or the fake screen won't emit any light.

chenleicrm commented 2 years ago

OK I will try this next week ,and I also want to know why the model is oranged when i disable the light estimate

ThomasGorisse commented 2 years ago

Your model has a well defined material for the phone structure (metal) but not for the screen part: image

ThomasGorisse commented 2 years ago

Here you can see that you only have black Emission image

chenleicrm commented 2 years ago

Here you can see that you only have black Emission image

thanks for your patience

chenleicrm commented 2 years ago

Screenshot_20220218-104636_SceneFormDemo As you can see. Phone modal surface is black when I use REALISTIC or SPECTACULAR config Screenshot_20220218-105430_SceneFormDemo And phone modal surface turns out to be oranged when I use DISABLED mode

Can you help to check the second picture. When i disable the light estimate. the phone model is oranged

ThomasGorisse commented 2 years ago

This might be a FILMIC issue we solved on the today release 1.20.5. Please update your depency version, and post the same screenshot.

chenleicrm commented 2 years ago

This might be a FILMIC issue we solved on the today release 1.20.5. Please update your depency version, and post the same screenshot. Screenshot_20220220-154541

here is the picture I update depency version to 1.20.5, It seems like no change, You can also use model above to check it

chenleicrm commented 2 years ago

https://user-images.githubusercontent.com/10569293/154829616-e4a3afa6-96c9-41a9-9385-2ceb54888f88.mp4

Screenshot_20220220-182540

As you can see in the video above, phone surface turns to be black gradually. And the image is the normal state . I am curious about what happens in the video

chenleicrm commented 2 years ago

https://user-images.githubusercontent.com/10569293/154830454-0d7d8ff5-316a-41a6-9880-f52354655e14.mp4

I try many times, phone model surface is always show black only in the direction where i just place it on the plane. and show normal when i rotate the model to other direction

chenleicrm commented 2 years ago

AMBIENT_INTENSITY

I can not see the screen in AMBIENT_INTENSITY

ThomasGorisse commented 2 years ago

You have to modify a little bit your model. Some properties in it may come from an .obj or .fbx import and has to be changed a little bit to make it completely glTF PBR 3D engine ready. For exemple, here is how the metallic and roughness factors are made of inside your material:

image image

Meaning roughness is extracted from the Green channel and Metalic from the Blue of the right image

You have 3 choices:

  1. Modify the Image_1 image
  2. Separate parts of your phone inside Blender and apply metallic for phone structure and emission for the phone screen
  3. Completely disable environment lighting influence within Sceneform

@grassydragon Do you remember how to disable lighting influence on an object?

grassydragon commented 2 years ago

Do you remember how to disable lighting influence on an object?

It can be done like that or using an RGB node as an input to Surface: https://docs.blender.org/manual/en/latest/addons/import_export/scene_gltf2.html?#exporting-a-shadeless-unlit-material

ThomasGorisse commented 2 years ago

I was more thinking of a Filament way to do it.

chenleicrm commented 2 years ago

yes I want to disable the lighting influence on model in code when I set light estimate DISABLED @ThomasGorisse @grassydragon

chenleicrm commented 2 years ago

I change build dependencies to 1.18.10 , Both the phone surface and the DISABLE mode shows OK. Can this be any help.

chenleicrm commented 2 years ago

any update now. cause our program is on emergency about the model effect @ThomasGorisse @grassydragon

ThomasGorisse commented 2 years ago

Please consider sponsoring us if you need any urgent help. Because we already bring you precise answers and we also got our own "emergency" private remunerating things to do.

chenleicrm commented 2 years ago

Hi I have become a sponsor via open collective whose name is lei. You can check it and now I wanna to know how to disable the lighting influence on model in code when I set light estimate DISABLED . Thanks to your genius work.

grassydragon commented 2 years ago

Thank you! We will devote some time to see how this can be done.

grassydragon commented 2 years ago

The yellow color comes from the default HDR environment as it is described in this issue: https://github.com/SceneView/sceneform-android/issues/322#issuecomment-1049192113 The solution is to find a more suitable environment or generate a pure white environment at runtime: https://github.com/google/filament/discussions/3483#discussion-2561539 Using an InderectLight is the only way to set the ambient lighting in Filament.

@ThomasGorisse what is the best way to generate a pure white environment in your opinion?

ThomasGorisse commented 2 years ago

Setting the environment indirect light to null and increasing the main light should do the job but you won't have any reflection and everything on the model should look a little flat:

sceneView.environment = sceneView.environement.apply {
    indirectLight = null
    skybox = null
} 

Another solution would be to use a white standard studio HDR like this one: https://github.com/SceneView/sceneview-android/tree/main/samples/model-viewer/src/main/assets/environments

sceneView.environment.indirectLight = HDRLoader.loadEnvironment( context = requireContext(), hdrFileLocation = "environments/studio_small_09_2k.hdr", specularFilter = false ).indirectLight

https://user-images.githubusercontent.com/6597529/157545553-533cb4b2-d1d8-4e25-b557-403f8712bab0.mp4

ThomasGorisse commented 2 years ago

Even if it should be possible to use the IndirectLight.Builder to create a white environment with maybe some white texture reflection and irradiance, you could also simply open the previous .hdr with Gimp. Clear all to white and use it like mentioned before. Once it looks ok for you, just generate the ktx and use the KTXLoader instead of HDRLoader and the final consumption result should not be so far from a programmatic way.

ThomasGorisse commented 2 years ago

But one more time, this is not an environment issue but a wrong model material issue. A black phone metal material should not reflect its environment like this. It usually happens when trying to convert an fbx to Gltf without manually modifying the material nodes. A really better choice would be to use a Principled BSDF standard material model.

chenleicrm commented 2 years ago

Thanks for your professional answer, Is there a java way to change the environment.indirectLight of the sceneView

grassydragon commented 2 years ago

Setting the environment indirect light to null and increasing the main light should do the job but you won't have any reflection and everything on the model should look a little flat

I've tried that and since the main light is a directional light the model is lit only from this direction and is black from the opposite direction since there is no ambient light.

grassydragon commented 2 years ago

Is there a java way to change the environment.indirectLight of the sceneView

Yes, the extension methods can be accessed from the [FileName]Kt class and take the extended class instance as the first parameter.

chenleicrm commented 2 years ago

Is there any demo code in java since I am new here @grassydragon @ThomasGorisse

grassydragon commented 2 years ago

Here are the required changes for the Java sample application to disable the light estimation and load the alternative environment. However, the model doesn't look good in this case, particularly, the reflections: https://photos.app.goo.gl/BckDnWogzjKwjmDz7

I'm not sure what is the problem because it neither appears with the default environment nor when I open the model and new environment in the glTF Sample Viewer:

image

sample-ar-model-viewer-java.txt

@chenleicrm Can you try opening the model in the Filament glTF sample viewer to see if the problem is related to the combination of Filament and your model?

chenleicrm commented 2 years ago

I have try your demo code and phone surface shows OK in light estimate disable mode. genius work~ I will keep learning about this @grassydragon

chenleicrm commented 2 years ago

I think its time to close this issue and thanks to your patience and professional explain @ThomasGorisse

ThomasGorisse commented 2 years ago

Thanks for your financial contribution and the detailed issue report. Hope to see the SceneView logo inside your phone 3d model next time instead of "Spark" which may suggest that your app is using Spark AR 😄

chenleicrm commented 2 years ago

I think SceneView logo will appear on our product surface if it pass our test in next one or two weeks 😄

github-actions[bot] commented 1 year ago

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] commented 1 year ago

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.