FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Make layers feature optional for type quad so it works on devices not supporting WebXR layers by vincentfretin · Pull Request #5722 · aframevr/aframe · GitHub

Make layers feature optional for type quad so it works on devices not supporting WebXR layers - #5722

Merged
dmarcos merged 1 commit into
aframevr:masterfrom
vincentfretin:layers-feature-optional
May 18, 2025
Merged

Make layers feature optional for type quad so it works on devices not supporting WebXR layers#5722
dmarcos merged 1 commit into
aframevr:masterfrom
vincentfretin:layers-feature-optional

Conversation

Copy link
Copy Markdown
Contributor

Description:

Make layers feature optional for type quad so it works on devices not supporting WebXR layers. Please confirm @dmarcos that the Layer Quad example is working with the fallback to a plane on AVP.

Changes proposed:

  • Use optionalFeatures layers for types that have a fallback, requiredFeatures for types that don't have a fallback
  • Add this.layerEnabled in the condition to initLayer(), layerEnabled is false for devices not defining XRWebGLBinding or XRMediaBinding (when I tested the VR button on Chrome desktop, XRWebGLBinding was defined, XRMediaBinding was undefined)

Comment thread src/core/scene/a-scene.js Outdated
}

vrManager.layersEnabled = xrInit.requiredFeatures.indexOf('layers') !== -1;
vrManager.layersEnabled = xrInit.requiredFeatures.indexOf('layers') !== -1 || xrInit.optionalFeatures.indexOf('layers') !== -1;

mrxz May 15, 2025
edited
Loading

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

The fact that layers is part of the optionalFeatures does not mean that it will be available in the session. The check should use xrSession.enabledFeatures to determine this.

Though, sadly, some older WebXR implementations like on the Pico Neo3 (Link) and Pico 4 don't implement this, and enabledFeatures is undefined... (though they do support WebXR Layers)

Maybe something like:

vrManager.layersEnabled = xrSession.enabledFeatures ? xrSession.enabledFeatures.indexOf('layers') !== -1 : true;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks. Indeed I see such usage in threejs repo https://github.com/search?q=repo%3Amrdoob%2Fthree.js%20enabledFeatures&type=code
I'll change with the line you suggested.
I hope AVP have xrSession.enabledFeatures properly defined then, otherwise the example won't fallback to the plane, please confirm @dmarcos

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

On AVP, even if vrManager.layersEnabled is true, it won't actually do anything because we don't call addLayer from the layer component now that I did the proper check for XRWebGLBinding && XRMediaBinding.

… supporting WebXR layers

Properly use xrSession.enabledFeatures to see if layers feature is enabled, but still fallback to true for older WebXR implementations on some Pico headsets where enabledFeatures is undefined but they do support WebXR Layers
vincentfretin force-pushed the layers-feature-optional branch from f9cb9e1 to 2c24df1 Compare May 17, 2025 09:23

Copy link
Copy Markdown
Contributor Author

I got confirmation from another user that XRWebGLBinding and XRMediaBinding are undefined on AVP.
It should be good to merge.

dmarcos commented May 18, 2025

Copy link
Copy Markdown
Member

Thanks!

dmarcos merged commit fa918a8 into aframevr:master May 18, 2025
vincentfretin deleted the layers-feature-optional branch May 20, 2025 07:01
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL