-
Notifications
You must be signed in to change notification settings - Fork 822
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ar-placement ignored on quick look #3989
Comments
Indeed, it's not implemented yet. Any idea if there's a way to do this with the three.js USDZExporter? A PR would be most welcome. |
I checked the code over at threejs and it looks like it should be a small change to expose the placement options for the USDZExporter. I'll keep this issue updated on the progress there. |
Ok, so there is some good and bad news. threejs supports supplying an optional Unfortunately @types/three is still on 0.146.0 currently, so to test I had to ignore typing for now. But the main problem is how USDZ interprets "placing a 3D model on a wall". Specifically it will rotate the model automatically, such that the "feet" of the model are placed on the wall. This is different from how it works in Scene Viewer, where it will not rotate the model. For clarification see following pictures:
This also seems to be the case when using Reality Composer, where the model is rotated depending on the anchor type as well.
One ugly solution would be to rotate the model before converting it to usdz. That would make it consistent across platforms, but also kind of "lie" to Quick Look, which could become a problem in the future. The other solution I could think of is to leave the logic as it is. Maybe mention in the docs that Any thoughts on this? |
Ugh, good catch! I think I actually like the rotate-before-usdz-export option. The reason is that glTF specifies that +Y is up, hence the model-viewer/SceneViewer behavior. QuickLook's behavior implies USDZ has a different convention, so I think making this change as part of the conversion is appropriate. Likewise, we anchor at the center of the anchored bounding box face, so we may need to account for that too as part of this transform. I have no problem with |
Hmm, well I am not too sure if it's easy to implement rotating the model before converting. Any pointers? I would be happy to fix this, but is there anywhere where model-viewer already transforms .glb models like this? |
Sure, search for the implementation of |
From https://developer.apple.com/documentation/realitykit/uniform-token-preliminary-planeanchoring-alignment we can set aligment to "any" to snap on floor or wall. I tested the "any" in the USDZExporter options, unfortunately the model also rotate automatically, like "vertical". I noticed that if we remove the two lines https://github.com/mrdoob/three.js/blob/aaafb4ffe8830932e31aa44003376457265d126a/examples/jsm/exporters/USDZExporter.js#L209-L210 it actually works fine, the model is not rotated and it snaps on both floor and wall. I found out this because producing a usdz with another tool didn't add those properties and using ios-src with this usdz worked fine on the wall. |
Interesting; presumably that means we can also control this from the MV side by changing the options we specify. Do you have a recommendation on what changes would be useful? |
We need a way in threejs USDZExporter to not add those lines. We could probably use the following: const usdzOptions = {
ar: undefined
};
const exporter = new USDZExporter() as any;
const arraybuffer = await exporter.parse(model, usdzOptions); and in https://github.com/mrdoob/three.js/blob/aaafb4ffe8830932e31aa44003376457265d126a/examples/jsm/exporters/USDZExporter.js#L209-L210 |
I also have some updates. I tried for two days to get the rotation and position resetting right, with the malformed test-model. But I just can't get it to work. What I tried was moving it to the origin, rotating, and then moving it again to the previous offset. I tried a lot of other things, but I just can't get it to work. |
Thanks @pixlhero for trying. Somewhat related to this, I wrote in the WebXR UX improvements thread about |
hi there, thanks! |
There is technically. But it works different on iOS/QuickLook. It's actually embedded in the .usdz file. At the moment the best way seems to be to provide the usdz file yourself with |
I just pushed a PR for three.js mrdoob/three.js#28363 to allow removing the alignment properties in the generated usdz. If you want to test my branch ios-placement-wall:
|
FYI mrdoob/three.js#28363 is merged and types will also be up to date three-types/three-ts-types#938 for r165. |
Description
It seems that the
ar-placement
option gets ignored on AR Quick Look. Is this a bug or intended behaviour? If it's intended, the documentation should mention that imo. If it's not implemented yet, it should at least be possible to make it available when converting the .glb to .usdz file, because the placement info is embedded into the .usdz file for Quick Look.Live Demo
on iOS doesn't show the vertical wall, but the horizontal floor at the onboarding animation:
https://modelviewer.dev/examples/augmentedreality/index.html#wall
Version
Browser Affected
OS
AR
The text was updated successfully, but these errors were encountered: