[Draft] Fix sky rendering with multiview in OpenGL
Currently, with multiview in the OpenGL renderer, the sky won't render at all (you just see the clear color). This PR is an attempt to fix that!
This is currently a draft because I basically threw this together with lots of copy-paste and not a lot of thought. :-) I'll spend some more time on it over the weekend, before sending it off to the rendering gurus for review. (I also haven't tested on a real headset, just using the MobileVRInterface, so this'll need some proper testing too.)
This is working when I test it with the MobileVRInterface, but not when trying with OpenXR on the Quest or WebXR. :-/
I just tried with OpenXR (on Windows) using Air Link to my Quest 2, but unfortunately, it doesn't work there either. :-/
I had thought that maybe the problem was OpenGL vs GLES3, but that doesn't appear to be the case. I'm not sure what about MobileVRInterface allows it to work, whereas it fails with all other interfaces I've tried.
OMG, I've been losing my mind on this issue for the past 3 days, but I think I've finally figured out why it works with MobileVRInterface but not WebXRInterface or OpenXRInterface: on the latter two interfaces we are rendering directly to the device, which means Y is inverted. Without flipping Y on the screen triangle, I think it's getting back face culled. In any case, just sticking a * -1.0 on the Y value in the vertex shader gets the sky showing up!
I still need to update this PR to invert Y when needed, but at least I finally know what to do. :-)
Alright! This is finally working on WebXR and OpenXR in my testing, and so is now ready for review from the rendering experts :-)
@clayjohn @BastiaanOlij Could you please review when you have a chance? Thanks!
The test failure is unrelated to this PR. Should be fixed in https://github.com/godotengine/godot/commit/2b710bc336a02ace95eb0588f3b0744923faf004 so I just rebased this PR on it
@dsnopek very good work mate, the code looks really good. I think there is more work to be done to get half res and quarter res to work but I suggest we get this merged first, and then take a separate look at making half res and quarter res work in stereo.
It's probably mostly changing the allocation of the buffers and tweaking the code that renders these images, but in the Vulkan renderer we also moved the code where we render to these to an earlier stage. Less important here probably because we're not using subpasses in OpenGL but still.
Thanks :-)
I think there is more work to be done to get half res and quarter res to work but I suggest we get this merged first, and then take a separate look at making half res and quarter res work in stereo.
I don't think quarter and half res are hooked up in OpenGL at all, even for non-stereo - at least I couldn't find it! I suspect @clayjohn didn't get around to porting that yet?
I don't think quarter and half res are hooked up in OpenGL at all, even for non-stereo - at least I couldn't find it! I suspect @clayjohn didn't get around to porting that yet?
Ah that would explain that. If that is so then I suggest we move that to 4.1. I do think its an important feature for low end
Thanks!