-
-
Notifications
You must be signed in to change notification settings - Fork 22.8k
Improvements to multiple layer support #108156
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
base: master
Are you sure you want to change the base?
Improvements to multiple layer support #108156
Conversation
bf479d9
to
9fb28dc
Compare
@@ -2704,6 +2706,9 @@ void RendererSceneCull::render_camera(const Ref<RenderSceneBuffers> &p_render_bu | |||
// For now just cull on the first camera |
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.
@dsnopek I haven't had time to test it yet but I believe this is where the issues with occlusion come from. We're initialising the occlusion system for the left eye instead of the combined frustum.
} else if (view_count == 2) { | ||
camera_data.set_multiview_camera(view_count, transforms, projections, false, false, camera->vaspect); | ||
} else if (p_view_count == 2) { | ||
camera_data.set_multiview_camera(p_view_count, transforms, projections, false, false, camera->vaspect); |
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.
@dsnopek @m4gr3d This is the other bit not directly related to this PR that I want to dive into more.
As you guys know, the logic that combines the view frustums of the left and right eye creates an encompassing frustum that we use for culling but in order for this to fit, we move the center position of the camera backwards.
As the player moves their head, this position will thus start rotating around the head position.
I think this may be what is causing the shadow flickering we've experienced in XR as this may trigger unnecessary movement in the directional light cascades.
Not as part of this PR but I might see if I can adjust this logic to keep the resulting transform centered on the eyes and encode the offset in the projection matrix. Just wanted to note it here so we don't forget about it.
9fb28dc
to
abc5748
Compare
abc5748
to
439bed7
Compare
Introduction
For advanced XR headsets we're required to render more than a single stereoscopic result. This approach has now been added as a standard to OpenXR for use by multiple headset vendors and support for it is growing. The Khronos Group is funding work for us to implement this.
This primary use case is well described in Varjo's documentation on the subject.
Here we are rendering two stereoscopic buffers of different resolutions and with different camera positions and projection settings.
This PR makes changes to the rendering engine in support of this.
Alternatives
Before settling on this approach we trailed two alternative solutions for this:
Bonus objectives
The approach in this PR solves more than the ability to render multiple sets of views in a viewport. It also:
TODO
This is still a work in progress:
_check_xr_size
logic in viewport.use_xr
on/off behaves correctlyImplements: godotengine/godot-proposals#12572
Contributed by Khronos Group through the Godot Integration Project