model-viewer icon indicating copy to clipboard operation
model-viewer copied to clipboard

modelviewer ar-placement= wall is flipping the glb model

Open anil-arnxt opened this issue 1 year ago • 17 comments

Description

I am using modelviewer to show glb model of an AC on the wall but its flipping it 360 degree when i place it on the wall.

Live Demo

Version

Screenshot_2024-05-06-12-29-24-231_com android chrome

Browser Affected

  • [x] Chrome, version: xx.x.xxxx.xx
  • [x] Edge
  • [x] Firefox
  • [x] IE
  • [x] Safari

OS

  • [x] Android
  • [ ] iOS
  • [ ] Linux
  • [ ] MacOS
  • [ ] Windows

AR

  • [x] WebXR
  • [ ] SceneViewer
  • [ ] QuickLook

anil-arnxt avatar May 06 '24 07:05 anil-arnxt

This is discussed in #3989

vincentfretin avatar May 06 '24 09:05 vincentfretin

Thanks for your reply. But I am working on Android not ios.

anil-arnxt avatar May 06 '24 09:05 anil-arnxt

https://github.com/google/model-viewer/assets/121437693/34fe3201-1d12-4312-8204-7d7369ffb332

anil-arnxt avatar May 06 '24 09:05 anil-arnxt

From the video, it seems to be an issue with SceneViewer on Android. In this case please check only the correct checkboxes on the issue. Not sure if we can do anything about it. You can set ar-modes="webxr quick-look" to force using webxr and not scene-viewer on Android. I didn't have an issue with webxr mode on Android.

vincentfretin avatar May 06 '24 10:05 vincentfretin

 <model-viewer
                    id="change-speed-demo"
                    camera-controls
                    touch-action="pan-y"
                    src={glbFile}
                    ar
                  ar-placement={placement}
              
                    alt="A 3D model of a helmet"
                    ref={modelViewerRef}
                    animation-name="Dance"
                    ar-modes="webxr scene-viewer quick-look"
                    shadow-intensity="1">
                    <button
                      slot="ar-button"
                      id="ar-button"
                      onClick={handlearclick}>
                      View in your space
                    </button>
                      {showOverlay && (
                    <div className="overlay">
                      <p>Move your device to place the object in AR</p>
                      <button onClick={handlePlaceObject}>Start AR</button>
                    </div>
                  )}
                  <div id="ar-prompt">
                    <img src="https://modelviewer.dev/shared-assets/icons/hand.png" />
                    <div id="wall_floor">
                      Move Camera on the <span>{placement}</span>
                    </div>
                  </div>

                  <div id="ar-failure">AR is not tracking!</div>
                    {hasAnimation && (
                      <div id="controls">
                        <button onClick={handleToggleAnimation}>
                          {isPlaying ? <FaPause /> : <FaPlay />}
                        </button>
                      </div>
                    )}
                  </model-viewer>  

this is my code for ios its not flipping but when opening on android its flipping the model.

anil-arnxt avatar May 06 '24 10:05 anil-arnxt

No, that's WebXR mode alright. Weird! Does that repro reliably even on other walls? The only thing I can imagine is that the returned hit matrix has an inverted normal. @bialpio Have you ever seen anything like this, or have a thought as to where in the code that could happen? The relevant piece of MV code is:

    if (this.placeOnWall === true) {
      // Orient the model to the wall's normal vector.
      this.goalYaw = Math.atan2(hitMatrix.elements[4], hitMatrix.elements[6]);
    }

which I don't see any problems with. hitMatrix is returned right from the WebXR API.

elalish avatar May 13 '24 18:05 elalish

@anil-arnxt Can you fill in the device and OS/browser version info so we can try to repro?

elalish avatar May 13 '24 18:05 elalish

@elalish I am using Android version 12 and chrome browser.

anil-arnxt avatar May 14 '24 05:05 anil-arnxt

@anil-arnxt Can we have more details on your device type and browser version? (the xx.x.xxxx.xxx are intended to be filled in by you as part of the issue template).

elalish avatar May 15 '24 20:05 elalish

@elalish please see my device that is mobile details Screenshot_2024-05-16-10-50-01-027_com android settings Screenshot_2024-05-16-10-49-54-807_com android settings Screenshot_2024-05-16-10-50-23-641_com android chrome

anil-arnxt avatar May 16 '24 05:05 anil-arnxt

Hi @elalish, I am also having this issue and noticed it started happening about a week ago for me with projects that I had made no changes to and that never had this problem before. As soon as i place an object on the wall such as a painting, it immediately flips 180 degrees and is now hard to rotate to correct face. I am using webxr and not scene viewer and as mentioned, this issue did not exist before and is also happening with the wall placement example provided on your site https://modelviewer.dev/examples/augmentedreality/#wall. Would like to know how this can be fixed as it is an issue with commercial clients intending to use MV for wall placements. Thanks.

luciousBrown avatar May 29 '24 14:05 luciousBrown

You're quite correct - @devbridie has verified this is a regression in the latest version of ARCore. Working on a fix, but not sure exactly when it'll roll out yet.

elalish avatar May 30 '24 15:05 elalish

Hi @elalish thanks for looking into this. Have had to put a pause on some client projects as even though can use Sceneviewer, it is not as good as modelviewer in my opinion in regards to lighting and customization etc. iOS quicklook users are having no problems though.

luciousBrown avatar May 31 '24 16:05 luciousBrown

This issue will be resolved in ARCore 1.44 which is expected to go out in a few weeks.

devbridie avatar Jun 04 '24 14:06 devbridie

Hi @devbridie thanks for the update. Looking forward to the fix.

luciousBrown avatar Jun 05 '24 14:06 luciousBrown

Hey, would love to hear if the recent updates have resolved your issue. Please verify that Google Play Services for AR is version 1.44 on the target devices and let me know if it's fixed!

devbridie avatar Jun 21 '24 09:06 devbridie

Just updated to 1.44 and can confirm that, for me at least, I'm seeing an improvement. Vertically anchored models are no longer flipping.

milesgreen avatar Jun 26 '24 13:06 milesgreen