-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Added WebXR SpaceWarp renderer flag #5795
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,6 +35,7 @@ It also configures presentation attributes when entering WebVR/WebXR. | |
| | maxCanvasWidth | Maximum canvas width. Uses the size multiplied by device pixel ratio. Does not limit canvas width if set to -1. | -1 | | ||
| | maxCanvasHeight | Maximum canvas height. Behaves the same as maxCanvasWidth. | -1 | | ||
| | multiviewStereo | Enables the use of the OCULUS_multiview extension. | false | | ||
| | spaceWarp | Enables SpaceWarp motion vector rendering when supported. | false | | ||
| | logarithmicDepthBuffer | Whether to use a logarithmic depth buffer. | auto | | ||
| | precision | Fragment shader [precision][precision] : low, medium or high. | high | | ||
| | alpha | Whether the canvas should contain an alpha buffer. | true | | ||
|
|
@@ -43,7 +44,7 @@ It also configures presentation attributes when entering WebVR/WebXR. | |
| | exposure | When any toneMapping other than "no" is used this can be used to make the overall scene brighter or darker | 1 | | ||
| | anisotropy | Default anisotropic filtering sample rate to use for textures | 1 | | ||
|
|
||
| > **NOTE:** Once the scene is initialized, none of these properties may no longer be changed apart from "exposure", "toneMapping", "sortTransparentObjects" and "foveationLevel" which can be set dynamically. | ||
| > **NOTE:** Once the scene is initialized, none of these properties may no longer be changed apart from "exposure", "toneMapping", "sortTransparentObjects", "foveationLevel", and "spaceWarp" which can be set dynamically. | ||
|
|
||
| ### antialias | ||
|
|
||
|
|
@@ -111,3 +112,7 @@ Whether the canvas should contain an alpha buffer. If this is true the renderer | |
| ### multiviewStereo | ||
|
|
||
| Performance improvement for applications that are CPU limited and draw count bound. Most experiences will get a free perf gain from this extension at not visual cost but there are limitations to consider. multiview builds on the multisampled render to texture extension that discards the frame buffer if there are other texture operations during rendering. Problem outlined in https://github.com/KhronosGroup/WebGL/issues/2912. Until browsers and drivers allow more control of when multisample is resolved we have a workaround with some drawbacks. As a temporary solution when enabling multiview the upload of texture data is deferred until the rendering of the main scene has ended, adding one extra frame of latency to texture uploads. Scenarios affected are for example skeletal meshes that upload bone textures with TexImage. With the workadound in place all bone animations will lag by one frame. Another issue is rendering mirror reflexions or rendering another view in the middle of the scene. The logic would have to move to the beginning of the frame to make sure it's not interrupted by the multiview frame. Because of the limitations this flag is disabled by default so developers can address any issues before enabling. | ||
|
|
||
| ### spaceWarp | ||
|
|
||
| Enables SpaceWarp motion vector rendering when supported by the device and browser. This requires `multiviewStereo: true` and requesting the `space-warp` WebXR feature (see the [`webxr` system](./webxr.md)). This flag can be toggled at runtime to pause or resume the motion vector pass. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might be a good idea to link to the WebXR space warp spec or the WebXR Space Warp documentation page by Meta. Additionally a note can be added to indicate that this features is limited to the Meta Quest browser (at least for now) |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,7 @@ export var System = registerSystem('renderer', { | |
| maxCanvasWidth: {default: -1}, | ||
| maxCanvasHeight: {default: -1}, | ||
| multiviewStereo: {default: false}, | ||
| spaceWarp: {default: false}, | ||
| exposure: {default: 1, if: {toneMapping: ['ACESFilmic', 'linear', 'reinhard', 'cineon', 'AgX', 'neutral']}}, | ||
| toneMapping: {default: 'no', oneOf: ['no', 'ACESFilmic', 'linear', 'reinhard', 'cineon', 'AgX', 'neutral']}, | ||
| precision: {default: 'high', oneOf: ['high', 'medium', 'low']}, | ||
|
|
@@ -60,6 +61,10 @@ export var System = registerSystem('renderer', { | |
| var toneMappingName = this.data.toneMapping.charAt(0).toUpperCase() + this.data.toneMapping.slice(1); | ||
| renderer.toneMapping = THREE[toneMappingName + 'ToneMapping']; | ||
| renderer.toneMappingExposure = data.exposure; | ||
| renderer.spaceWarp = data.spaceWarp; | ||
| if (renderer.xr) { | ||
| renderer.xr.isSpaceWarp = data.spaceWarp && renderer.xr.isMultiview; | ||
| } | ||
|
Comment on lines
+64
to
+67
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ideally there'd be a single flag to toggle space warp. Having to set
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks these are all great changes. When I started I was making it like multiview but if it is just enabled with the optional feature then it could be toggled with renderer.xr.spaceWarp like that. I think I was imagining being able to set it to false by default in the a-scene while still having it enabled in the renderer so it could be set to true later during runtime. |
||
| renderer.xr.setFoveation(data.foveationLevel); | ||
|
|
||
| if (data.sortObjects) { | ||
|
|
||
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.
While it was already the case, there's a double negation here "none of these properties may no longer".