Repository navigation
Add multiview support for XRProjectionLayer - #11828
Conversation
RaananW
left a comment
There was a problem hiding this comment.
Oh, this is so great :-)
What would be the way to use this?
I saw you mentioned a flag. I think semantically putting the flag in the XR layers feature might be a little confusing. Though it is directly related to the feature.
We want to make it as simple as possible to use the feature, while allowing as much flexibility as possible.
|
So the main idea is that you'd specify multiview for the layer you're creating, and that layer would render using multiview: layersFeature.createProjectionLayer(params, true);(It seems we might also be able to use multiview for quad layers down the road) The one thing to note is that we don't currently have a way of doing non-multiview if the textureType is I think for now, to avoid a path where the user creates a projection layer with |
Let's create an issue and follow that, as this can be very confusing for a developer trying to use a texture-array. |
This change hooks up the
XRProjectionLayerto our existing xr multiview rendering implementation. The"texture-array"texture type inXRProjectionLayerInitis designed to be used with the multiview WebGL extension, and so we use multiview rendering whenever"texture-array"is specified as the texture type.Before:

After:

Taking performance profiles on an Oculus quest with a playground rendering 400 default-fidelity spheres (https://playground.babylonjs.com/#F41V6N#705), I got the following per-frame times for multiview turned off and on:
Multiview off
Multiview on
Exported profiles from Chrome DevTools:
xr-multiview-profiles.zip
So we got some significant performance wins on both the CPU and GPU, as would be expected. With scene.render taking up around 95% of the entire time for the frame, cutting the time for that function down in half just about doubled the overall FPS.
Even with one sphere, I'm still seeing around a 10% decrease in frame time (40% in scene.render) and about a 20% decrease in GPU time.
fixes #10767