Hi,
Recently I tried to enable the new WebXr layers feature so that the Quest 2 renders both eyes in a single pass.
It is most definitely a performance improvement, however I did see 2 issues when enabling this feature with a skybox and environment:
When exiting XR on the Quest 2 using the playground with Multiview enabled (https://playground.babylonjs.com/#9K3MRA#741) the view rendered in the 2d Oculus browser has reflections that are broken in the same way as they used to be in XR (my original post)
Thanks for reporting!
Apart from the antialiasing (which is a known issue with multiview in general, solved by the OCULUS muttiview extension), the other 2 are bugs. Do you mind opening a github issue to track them? ping me there, i’ll make sure to tag and assign it.
Hi @RaananW,
Thanks for getting back to me, I’ll create the 2 bugs first tomorrow
However I do believe there is an issue with the implementation of the OCULUS muttiview extension as I am testing on A Quest 2 and see aliasing.
After reading through the code I see that the method bindMultiviewFramebuffer of file engine.multiview.ts calls framebufferTextureMultisampleMultiviewOVR, once with the colour and once with the stencil. For both of these calls multiviewTexture.samples is passed in as the samples parameter, however this value is 0. My understanding is that it would need to be a value of 2, 3 or 4 for anti-aliasing to work.
As a quick test in my own project I set the Engine.prototype.bindMultiviewFramebuffer myself and hardcoded the samples to be 4 and anti-aliasing started working on My Quest 2. I did have some weird issues, that may be related to rendering layers (layer 0 wasn’t rendered until I added another item to my scene) but it was a quick test as it is quite late where I am right now.
I shall revisit it tomorrow, but I would appreciate your thoughts on this.
I also looked further into the aliasing issue on the Quest 2. Here is a playground where I force the samples parameter to be 4 when calling into framebufferTextureMultisampleMultiviewOVR: https://playground.babylonjs.com/#9K3MRA#794
Note that nothing on renderingGroupId=0 actually renders, so all items except the skybox are moved to renderingGroupId=1, which ensures they are rendered.
All of the rendered items are correctly anti-aliased on the Quest 2. Am I missing something in the configuration which enables anti-aliasing correctly on the Quest 2 when multi-view is enabled? Or is this an example of a real issue, and that samples should in fact be set to the value held within the Engine.getCaps().maxSamples ?
If I am correct about the samples, then why would rendering group 0 be ignored? (maybe it is cleared after being rendered?)
That’s an interesting catch. The number of samples is set on the class MultiviewRenderTarget, which is the RTT used when enabling multiview. When initializing it, is uses this.samples = this._getEngine()!.getCaps().maxSamples || this.samples; to set the number of samples (defaults to 1). So it should work as expected! keyword is “should”. I’ll have to debug this and see what’s going on there. Let me assign myself and get back to you on this one. I am sadly a bit swamped at the moment, but I promise to take the time to check that.
Hi @RaananW,
I was just wondering if you have had chance to look into the samples issues when using the Oculus Multiview extension? It seems that the number of samples is still not being set correctly to me.
I can confirm that when I over-ride the Engine.bindMultiviewFramebuffer method to force the number of samples to 4,I no longer get issues with layers: https://playground.babylonjs.com/#9K3MRA#808