google / model-viewer

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

SceneViewer gets Rotation of some GLB Files wrong compared to Khronos glTF Sample Viewer #1067

Closed cnsboth closed 4 years ago

cnsboth commented 4 years ago

Description

In our company we are using Scene Viewer to enable AR for our 3D web viewer. We noticed that some models have the wrong orientation in AR as well as in the Scene Viewer Preview but not in other gltf viewers like https://github.khronos.org/glTF-Sample-Viewer/

I analyzed the gltf-Files to see if I notice any difference that causes the issue but I couldn't find any. It only happens to some of our generated gltfs and I have no idea why. I think it has something to do with the transformation matrices in the gltfs. They are the same (rotation-wise) in the two examples I provide below but lead to different results somehow.

Here is how one example is oriented in SceneViewer in Front View: pipe-scene-viewer-preview

Here is the same glb in Khronos gltf Sample Viewer in Front View: pipe-gltf-sample-viewer

Here are two example .glb files. In pipe-valve.glb the issue occurs and in chair.glb the issue does not occur: example-glbs.zip

Browser Affected

OS

cdata commented 4 years ago

@boris-vincent thanks for the report!

cc @tpsiaki who may be able to comment on behalf of Scene Viewer

cnsboth commented 4 years ago

@cdata i've investigated the issue further and now I know where the problem lies. SceneViewer throws away rotation information from a matrix if the scale factor is very small.

https://github.com/google-ar/sceneform-android-sdk/issues/1058 I've recreated the issue on the sceneform github, so it can be closed here. Thanks