-
-
Notifications
You must be signed in to change notification settings - Fork 22.8k
Fix GLES3 stereo output (sRGB + lens distortion) #107698
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
Fix GLES3 stereo output (sRGB + lens distortion) #107698
Conversation
#ifdef USE_TEXTURE_3D | ||
vec4 color = textureLod(source_3d, vec3(uv_interp, layer), lod); | ||
vec4 color = textureLod(source_3d, vec3(uv, layer), lod); |
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.
Note, this extra indent is clang-format being annoying...
|
||
Rect2 dst_rect = blit.dst_rect; | ||
_blit_render_target_to_screen(rid_rt, p_screen, dst_rect, blit.multi_view.use_layer ? blit.multi_view.layer : 0, i == 0); | ||
_blit_render_target_to_screen(p_screen, p_render_targets[i], i == 0); |
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.
Figured just providing our data as it already is as a parameter, would be much more efficient than copying all the members as parameters.
I wonder if we should insert _blit_render_target_to_screen
into blit_render_targets_to_screen
, there really isn't a good benefit to these being split.
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.
Thanks!
The code changes seem OK to me, but probably should get review from someone on the rendering team.
I tested on Linux with the MobileVRInterface
and it seems to be working great! However, I can't reproduce the issue with incorrect colors on MobileVRInterface
, that issue is specific to OpenXR on the desktop, and I don't have time to reboot my computer to Windows at the moment. :-)
If anyone else has time to confirm the fix with OpenXR on Windows, that'd be awesome! Otherwise, I'll give it a test later when I've got a chance.
b5b6d6d
to
37b7f57
Compare
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.
LGTM!
Thanks! |
This PR fixes two issues in the compatibility renderer.
First, when using OpenXR we have to use
GL_SRGB8_ALPHA8
buffers to render to. This triggers a hardware sRGB->Linear conversion when we are reading from this buffer with our final blit to screen. We need to revert that conversion to get proper colors.Fixes #107655
Second, we never copied over our lens distortion shader used by our
MobileVRInterface
implementation. This is thus a long standing regression from Godot 3.6 that stops people from using Godot with cardboard-ish phone VR (which yes, still gets used to this day).This can be tested with: godotengine/godot-demo-projects#1212