Skip to content

Commit 86b1dc4

Browse files
tbirdsofloryst
authored andcommitted
docs(webxr): prefer VR over AR session in XR documentation
Updates the default XR session type preference in WebXRVolume and GeometryViewer examples to better reflect our current XR supported devices list. Previously single-screen mobile devices were the only devices supporting both VR (Cardboard) and AR sessions with AR generally favored, so AR mode was made the default. Recently vtk.js added support for HMDs compatible with both VR and AR (passthrough) mode, which require stereoscopic AR rendering different from the mobile AR approach. Under the status quo the default behavior on such an HMD was to attempt to render in AR mobile as if it were a mobile device, which would produce incorrect renderings. This change prefers rendering in VR mode such that default HMD behavior will be rendering in full virtual reality and some mobile devices may render in Cardboard VR mode by default. AR HMD and AR mobile experiences may still be accessed through explicit, non-default links in the WebXR documentation landing page. re #2862
1 parent f563622 commit 86b1dc4

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

Documentation/content/docs/develop_webxr.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ The following examples target a head-mounted virtual reality device, such as the
7272
[![VR Cone Example][VrCone]](../examples/VR.html)
7373
[![SkyboxViewer Example][SkyboxViewerVR]](../examples/SkyboxViewer.html?fileURL=https://data.kitware.com/api/v1/file/5ae8a89c8d777f0685796bae/download)
7474
[![GeometryViewer Brain Blood Vessels][GeometryViewerBrainBloodVessels]](../examples/GeometryViewer/GeometryViewer.html?xrSessionType=0&fileURL=[https://kitware.github.io/vtk-js/examples/GeometryViewer/GeometryViewer.html?xrSessionType=0&fileURL=%5Bhttps://data.kitware.com/api/v1/file/61f041f14acac99f42c2ff9a/download,https://data.kitware.com/api/v1/file/61f042024acac99f42c2ffa6/download,https://data.kitware.com/api/v1/file/61f042b74acac99f42c30079/download%5D])
75-
[![XR Volume Example][WebXRVolume]](../examples/WebXRVolume/WebXRVolume.html?xrSessionType=0&fileURL=https://data.kitware.com/api/v1/file/63fe3f237b0dfcc98f66a857/download&colorPreset=CT-AAA&rotateX=90&rotateY=180)
75+
[![XR Volume Example][WebXRVolumeHeadAndNeck]](../examples/WebXRVolume/WebXRVolume.html?xrSessionType=0&fileURL=https://data.kitware.com/api/v1/file/63fe3f237b0dfcc98f66a857/download&colorPreset=CT-AAA&rotateX=90&rotateY=180)
7676

7777
</div>
7878

@@ -84,7 +84,7 @@ The following examples target a handheld or head-mounted mobile augmented realit
8484

8585
[![AR Cone Example][ArCone]](../examples/AR.html)
8686
[![GeometryViewer Brain Blood Vessels][GeometryViewerBrainBloodVessels]](../examples/GeometryViewer/GeometryViewer.html?xrSessionType=1&fileURL=[https://kitware.github.io/vtk-js/examples/GeometryViewer/GeometryViewer.html?xrSessionType=0&fileURL=%5Bhttps://data.kitware.com/api/v1/file/61f041f14acac99f42c2ff9a/download,https://data.kitware.com/api/v1/file/61f042024acac99f42c2ffa6/download,https://data.kitware.com/api/v1/file/61f042b74acac99f42c30079/download%5D])
87-
[![XR Volume Example][WebXRVolume]](../examples/WebXRVolume/WebXRVolume.html?xrSessionType=1&fileURL=https://data.kitware.com/api/v1/file/63fe3f237b0dfcc98f66a857/download&colorPreset=CT-AAA&rotateX=90&rotateY=180)
87+
[![XR Volume Example][WebXRVolumeHeadAndNeck]](../examples/WebXRVolume/WebXRVolume.html?xrSessionType=1&fileURL=https://data.kitware.com/api/v1/file/63fe3f237b0dfcc98f66a857/download&colorPreset=CT-AAA&rotateX=90&rotateY=180)
8888

8989
</div>
9090

@@ -98,7 +98,7 @@ Microsoft HoloLens 2 users should run the [virtual reality examples](#Virtual-Re
9898

9999
[![AR Cone Example][ArCone]](../examples/AR/index.html?xrSessionType=3)
100100
[![GeometryViewer Brain Blood Vessels][GeometryViewerBrainBloodVessels]](../examples/GeometryViewer/GeometryViewer.html?xrSessionType=3&fileURL=[https://kitware.github.io/vtk-js/examples/GeometryViewer/GeometryViewer.html?xrSessionType=0&fileURL=%5Bhttps://data.kitware.com/api/v1/file/61f041f14acac99f42c2ff9a/download,https://data.kitware.com/api/v1/file/61f042024acac99f42c2ffa6/download,https://data.kitware.com/api/v1/file/61f042b74acac99f42c30079/download%5D])
101-
[![XR Volume Example][WebXRVolume]](../examples/WebXRVolume/WebXRVolume.html?xrSessionType=3&fileURL=https://data.kitware.com/api/v1/file/63fe3f237b0dfcc98f66a857/download&colorPreset=CT-AAA&rotateX=90&rotateY=180)
101+
[![XR Volume Example][WebXRVolumeHeadAndNeck]](../examples/WebXRVolume/WebXRVolume.html?xrSessionType=3&fileURL=https://data.kitware.com/api/v1/file/63fe3f237b0dfcc98f66a857/download&colorPreset=CT-AAA&rotateX=90&rotateY=180)
102102

103103
</div>
104104

@@ -110,7 +110,7 @@ The following examples target holographic displays from Looking Glass Factory. M
110110

111111
[![Looking Glass Cone Example][LookingGlassCone]](../examples/LookingGlass.html)
112112
[![GeometryViewer Brain Blood Vessels][GeometryViewerBrainBloodVessels]](../examples/GeometryViewer/GeometryViewer.html?xrSessionType=2&fileURL=[https://kitware.github.io/vtk-js/examples/GeometryViewer/GeometryViewer.html?xrSessionType=0&fileURL=%5Bhttps://data.kitware.com/api/v1/file/61f041f14acac99f42c2ff9a/download,https://data.kitware.com/api/v1/file/61f042024acac99f42c2ffa6/download,https://data.kitware.com/api/v1/file/61f042b74acac99f42c30079/download%5D])
113-
[![XR Volume Example][WebXRVolume]](../examples/WebXRVolume/WebXRVolume.html?xrSessionType=2&fileURL=https://data.kitware.com/api/v1/file/63fe3f237b0dfcc98f66a857/download&colorPreset=CT-AAA&rotateX=90&rotateY=180)
113+
[![XR Volume Example][WebXRVolumeHeadAndNeck]](../examples/WebXRVolume/WebXRVolume.html?xrSessionType=2&fileURL=https://data.kitware.com/api/v1/file/63fe3f237b0dfcc98f66a857/download&colorPreset=CT-AAA&rotateX=90&rotateY=180)
114114

115115
</div>
116116

Examples/Applications/GeometryViewer/index.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,14 @@ if (requestedXrSessionType === XrSessionTypes.LookingGlassVR) {
101101
// eslint-disable-next-line no-new
102102
new obj.LookingGlassWebXRPolyfill();
103103
});
104-
} else if (requestedXrSessionType === null && navigator.xr !== undefined) {
105-
// Determine supported session type
106-
navigator.xr.isSessionSupported('immersive-ar').then((arSupported) => {
107-
if (arSupported) {
108-
requestedXrSessionType = XrSessionTypes.MobileAR;
104+
} else if (requestedXrSessionType === null) {
105+
// Guess the session type based on what XR session(s) the device supports
106+
navigator.xr.isSessionSupported('immersive-vr').then((vrSupported) => {
107+
if (vrSupported) {
108+
requestedXrSessionType = XrSessionTypes.HmdVr;
109109
} else {
110-
navigator.xr.isSessionSupported('immersive-vr').then((vrSupported) => {
111-
requestedXrSessionType = vrSupported ? XrSessionTypes.HmdVR : null;
110+
navigator.xr.isSessionSupported('immersive-ar').then((arSupported) => {
111+
requestedXrSessionType = arSupported ? XrSessionTypes.MobileAR : null;
112112
});
113113
}
114114
});

Examples/Volume/WebXRVolume/index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,13 @@ if (requestedXrSessionType === XrSessionTypes.LookingGlassVR) {
8585
new obj.LookingGlassWebXRPolyfill();
8686
});
8787
} else if (requestedXrSessionType === null) {
88-
// Determine supported session type
89-
navigator.xr.isSessionSupported('immersive-ar').then((arSupported) => {
90-
if (arSupported) {
91-
requestedXrSessionType = XrSessionTypes.MobileAR;
88+
// Guess the session type based on what XR session(s) the device supports.
89+
navigator.xr.isSessionSupported('immersive-vr').then((vrSupported) => {
90+
if (vrSupported) {
91+
requestedXrSessionType = XrSessionTypes.HmdVr;
9292
} else {
93-
navigator.xr.isSessionSupported('immersive-vr').then((vrSupported) => {
94-
requestedXrSessionType = vrSupported ? XrSessionTypes.HmdVR : null;
93+
navigator.xr.isSessionSupported('immersive-ar').then((arSupported) => {
94+
requestedXrSessionType = arSupported ? XrSessionTypes.MobileAR : null;
9595
});
9696
}
9797
});

0 commit comments

Comments
 (0)