-
-
Notifications
You must be signed in to change notification settings - Fork 35.9k
WebXRManager: Add Raw Camera Access module. #31487
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
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
Any chance this makes r179? My actual use case is further downstream... :) |
I've removed the Do you mind temporarily updating the builds so I can test the PR with a Quest 2 over |
Thanks! I have a built version for my own purposes on https://github.com/mikeskydev/three.js/tree/cam-access-build , but be aware |
Thanks for the heads-up. I can still test if the depth sensing demos work so we have no regression on that side. |
There seems to be no change in behavior 👍 . However, it seems like depth sensing is currently broken in production. When I understand webxr_xr_dragging_custom_depth correctly, the meshes should be occluded by objects in the real world (see https://x.com/rcabanier/status/1748050448270135425). However, I don't get objects occluded at least on my Quest 2. They are always rendered in front of everything. There are no WebGL/WebXR warnings in the browser console when using remote debugging. /ping @cabanier I'm afraid a regression has sneaked in. Could you please have a look? |
I tried the depth example on my phone (which doesn't support depth) and it seems to silently fail as it's an optional feature, so it may also be depth sensing was turned off for quest browser at some point? |
Oh wait, it seems depth sensing only works with a Quest 3 since the Quest 2 does not have the required depth sensor. @cabanier Sorry for the ping 😇 . |
Depth sensing is no longer working with these changes. I'll investigate why. |
If I revert 6692d4d (Flip bool), depth sensing works again |
The texture retrieved via We've introduced const texProps = renderer.properties.get( texture );
texProps.__webglTexture = depthData.texture; If the depth sensing texture is wrapped into a |
Technically opaque textures should be bound every frame as they go invalid, In camera access it doesn't work unless I rebind in the loop. Any chance that depth was also working by a fluke and is also affected by the unbind? |
Yes, you need to rebind the textures every frame. This is because we play tricks under the hood and replace the underlying system texture. |
Fix typo.
@mikeskydev Thanks for working on camera access and implementing the |
Agreed, thanks for pushing for the cleaner solution, helping get the PR over the line and for your time, it's really appreciated! |
* | ||
* @augments Texture | ||
*/ | ||
class RawTexture extends Texture { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe ExternalTexture
could be a better name?
Are there other uses for it? If not, may be WebXRCameraTexture
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also use it for webxr depth textures, but there was some debate about naming in the linked issues and RawTexture was settled on. I could see it being useful for anything that uses raw texture handles, possibly protected content?
Closes #26452, Closes #26891
Description
This PR implements support for the WebXR Raw Camera Access module, and provides an example where the camera texture is placed on a rotating cube.
I have addressed the issue in #26452 by unbinding texture state if camera access is enabled, as it appears the module will automatically bind the raw camera textures at the beginning of the frame, which was affecting three.js's internal state tracking.
As this was tested on Chrome for android, this may be an implementation bug in Blink that has gone unnoticed, as their test case always rebinds textures.