XRManager: Add more integrated support for WebXR Layers.#30730
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
|
Can this be merged? I see some other issues in XRManager that I'd like to address. |
|
I finally tried this example on my Quest 2. When I go immersive the layers seem to be much darker than when outside immersive. @cabanier Known issues? Should I take screenshots? |
That wasn't happening before. Layers should be using the 2 pass rendering to do correct color managment.
These are both new. I will take a look. |
|
Things look very broken. It doesn't look like there's a depth buffer attached when rendering webxr... |
|
84b6feb7837d02cd445cfe2b17f2e5453c053a80 seems to be the cause of the breakage. I'll look into fixing it |
|
@mrdoob I don't see things rendered upside down when exiting XR, instead there are a bunch of GL errors. Are you on the dev branch? |
#31099 will fix the errors introduced by that change and the problem were layers were upside down. |
|
If the colors of the entire beauty pass are wrong, something with the color space conversion isn't right. When colors are too dark, it's normally an indication that the conversion to sRGB is missing. I have to debug the layers example so I say more about the issue. |
|
BTW: I have noticed below WebGL warnings in
|
|
Okay, so I think the issue is clear to me now.
I think it should be possible to fix the issue by evaluating the this._renderer.setOutputRenderTarget( layer.renderTarget );And and the end of the method: this._renderer.setOutputRenderTarget( null );@cabanier Do you see any issues with that approach? |
I have noticed that as well. It looks like a frame executes at at the start but the rendertarget isn't set up correctly yet. I will see why that is |
I tried that but it didn't seem to work. Are you saying that in the non-xr case, the color of the layers is adjusted twice which makes it too bright? |
|
The non-XR case looks right, imo. The layer colors during XR are too dark because the output pass is missing. When I understand the code correctly, rendering the layer while presenting must follow the same pattern as the XR pass. So the layer is rendered into an intermediate render target and then the second output pass is performed. That does currently not happen since the layer pass is treated like a normal RTT pass. So no color space conversion happens right now when presenting. |
|
I was able to fix the runtime error. PR is #31108 |
|
@Mugen87 I updated the PR and now everything renders as expected. It is very slow though... I'll look into that next |
#31124 will fix this. I'm still investigating the performance problem. |
This PR will introduce deeper integration of XR Layers in XRManager.
Layers will be emulated on devices that don't support them.
There are still some issues (ie color mapping is wrong) and the layers are not using multisampling but those can be addressed in later PR's.
This contribution is funded by Meta