google / model-viewer

Easily display interactive 3D models on the web and in AR!
https://modelviewer.dev
Apache License 2.0
6.97k stars 823 forks source link

3D models in Scene-Viewer are darker than in Model-Viewer #871

Closed areavisuale closed 3 years ago

areavisuale commented 5 years ago

Description

I noticed that when I export a glb file it has an acceptable lighting when I see it in model-viewer, but when I open scene-viewer (or AR QuickLook) it is darker. I don't know how to improve this, because I know that I can adjust lighting in model-viewer but not in scene-viewer/ar quicklook. The problem can be seen also with astronaut.glb here: https://modelviewer.dev/examples/augmented-reality.html.

Live Demo

https://modelviewer.dev/examples/augmented-reality.html

Browser Affected

OS

cdata commented 5 years ago

Unfortunately, at this time there is no way for you to configure the lighting in Scene Viewer. And, as far as Quick Look is concerned, we do not have any ability to communicate with or influence the Apple team that builds it so there isn't much that we can do about it.

That said, we are constantly making improvements to our rendering backend, and we are confident that with every iteration our rendering of the model is increasingly representative of the look intended by our users. When we make those improvements, we usually take what we have learned and share it with the Three.js, Scene Viewer and Filament teams. Our hope is that over time, all renderers will begin to converge on a common rendered result for any given input configuration.

It needs to be said that Scene Viewer will probably always lag behind <model-viewer> when it comes to customization. This is because Scene Viewer is a proprietary, first-party Google app that prioritizes maintaining a consistent look and feel over customization, where <model-viewer> is intended to be integrated directly with the content on your own web sites (so the ability to customize the look is very important). However, the default lighting in <model-viewer> is deliberately identical to the default lighting in Scene Viewer, so at the very least your model should look the same in both places when you use the defaults.

Anyway, this is great feedback for us to share with the related teams (Scene Viewer and Filament), so we should figure out what is most actionable for them.

cc @elalish who has been doing all of the work to shore up our rendering backend.

elalish commented 5 years ago

@areavisuale Also, because words like "darker" can be a tad vague in the realm of rendering, would you mind clarifying what you mean a little? For instance, if you make <model-viewer> darker by setting the exposure < 1, can you find a place where it matches scene-viewer / QuickLook? If so, we can ask them for an exposure parameter. However, I think the answer might be no, in which case any more description you can give us of the difference you notice will help us to correct the disparity.

areavisuale commented 5 years ago

I mean “darker” using the same device and the same browser, maintaining the default parameters. How can I change the exposure?

elalish commented 5 years ago

There is an exposure attribute you can set on the <model-viewer> element: https://modelviewer.dev/

areavisuale commented 5 years ago

Ok, the exposure setting doesn't seem to help me. I want to share with you these screenshots to understand better the situation: (screenshots taken with a Galaxy S7, Google Chrome, model-viewer dev website)

1) Model-viewer visualization: Screenshot_20191105-110359_Chrome

2) Scene-viewer (object mode) visualization Screenshot_20191105-110417_Google

3) Scene-viewer (ar mode) visualization Screenshot_20191105-110501_Google Screenshot_20191105-110517_Google

Considerations: In model-viewer and scene-viewer (object mode) the light come from the top of the model. In scene-viewer (object mode) the light is also "poor" and the result is too much dark. In scene-viewer (ar mode) there is a spot light that improves the model, but when I rotate the 3D, the light remains still.

Conclusions: The light should be exported with our glb file and used across all the visualizations. I'd like to know how that spot light has been inserted

cdata commented 5 years ago

@areavisuale what you are experiencing looks like a result of a Scene Viewer feature that attempts to estimate the lighting in the local area called Environmental HDR. The intention of this feature is to use local area light estimation to control the lighting used when presenting in AR, so in a darker room, the light on the model will be relatively darker.

I believe that Quick Look does something similar. It sounds like you might prefer the lighting you see in Quick Look. Can you share some Quick Look screenshots for us using the same room so that we can compare them?

areavisuale commented 5 years ago

Yes, the directional light seems to be related with Enviromental HDR. But I think this calculation of the light needs an intensity multiplier. I share with you the AR QuickLook version of the Astronaut (USDZ 3d model): IMG_3060

IMG_3061

IMG_3062

elalish commented 5 years ago

Thank you for the very clear comparisons! We will forward your feedback to the Scene Viewer team.

areavisuale commented 4 years ago

Are there any news? I tried with other 3D models and the result is the same. If I use Sceneviewer AR mode and I am in backlight, the model is completely black. I would like to know if the issue is only with my device, because I don't have any other to test it.

areavisuale commented 4 years ago

I GOT IT!!!

The problem seems to be the size of the 3d model. When I enter in AR mode, if the model is big (like the Astronaut), it results darker.

I tried with a 3d model of a painting booth (3meters x 3meters). When I start the AR mode in a backlight situation my model results black.

Model real size, scaled 50% down: 1574679945095

If I resize my model in my 3d software, to be 20cm x 20cm, in the same situation I have a correct illumination.

Model small version, scaled 400% up: 1574679803993

Could it be that the light in Scene-Viewer is partially covered when I have a big model?

areavisuale commented 4 years ago

I want to correct my previous assertion. Is not a problem related to big models. The problem is related in how I orientate my phone. If the phone points upwards all the model is dark (a typical situation for big models), if the phone points downwards the illumination is correct.

elalish commented 4 years ago

Thank you for the detailed info! We'll pass it along to Scene Viewer; I believe they are already looking into this.

elalish commented 4 years ago

@areavisuale The images you last shared look correct in that there is a bright model in a bright camera image and a dark model in a dark camera image. Can you share two versions where the lighting around the phone is basically the same but the rendering is different? That's what would indicate an error.

areavisuale commented 4 years ago

All 3d models (big, small...) are rendered in the same way, the problem is in the way ArCore calculates the global illumination. Is too sensible to dark areas, and too often it assumes that we are in a dark room only because there are some dark elements in the camera view.

In this animated gif you can see how my model is well illuminated only when i point the camera to the floor, when I point higher the model become completely black

boot

hbaugmentedreality commented 3 years ago

Hi @areavisuale, @elalish . Could you solve the problem? In my case, the models in quick-look (iOS - .usdz) are darker than in scene-viewer (Android). Same model. Same environment. Same everything. How can I add more light to the .usdz model? Thanks for your help!!!

elalish commented 3 years ago

@hbaugmentedreality This is a general problem with AR lighting estimation algorithms. Once iOS supports WebXR you'll be able to have some control over this, but until then all you can do is file a bug on Apple's QuickLook.