Fix stereo and 180 degree video rendering, add 360 stereo side-by-side - #2038
Open
NataleVIL wants to merge 3 commits into
Open
Fix stereo and 180 degree video rendering, add 360 stereo side-by-side#2038NataleVIL wants to merge 3 commits into
NataleVIL wants to merge 3 commits into
Conversation
VRLayer defaults useSameLayerForBothEyes to true. When it is set, OpenXRLayerBase::GetNumXRLayers() returns 1, so a single equirect layer is submitted with XR_EYE_VISIBILITY_BOTH and only the left eye's UV transform is applied. Both eyes then receive the same half of the frame and stereo video plays back mono. create180LRProjectionLayer already disabled the flag, but create360StereoProjectionLayer and create180TBProjectionLayer did not. The default is now documented where it is declared, since the path that got it right said nothing about it. Verified on a Pico Neo 3 (OpenXR) with an equirect test video whose top half is red and bottom half blue: before this change both eyes showed red, afterwards the left eye shows red and the right eye blue.
The 180 degree paths use a horizontal UV scale of 2 so the texture maps onto half the sphere. Without a matching -0.5 horizontal bias that half ends up 90 degrees off to the side: looking straight ahead shows the edge of the image, with black filling the rest of the view. create180LRProjectionLayer already applied the bias; create180ProjectionLayer and create180TBProjectionLayer did not. Verified on a Pico Neo 3 (OpenXR): the hemisphere is now centred on the forward direction instead of starting at the centre of the view.
Full-sphere stereo was only available as over/under. Side-by-side existed for 180 degree and flat 3D video, but not for 360, so side-by-side 360 content could not be viewed in stereo at all. Adds VIDEO_PROJECTION_360_STEREO_LEFT_RIGHT with both a mesh and a compositor-layer implementation, a menu entry with icon, and the mozVideoProjection=360lr query parameter. 360tb is accepted as an alias for 360s so the query-string vocabulary matches 180tb/180lr/3dtb; 360s keeps working. The specific values are matched before the bare 360 prefix, as already needed for 180lr and 180tb. Neither the "360 Stereo" label nor its icon said that it means over/under, which makes diagnosing content format problems harder than it needs to be. Both 360 modes now follow the naming scheme and the divider-bar icon convention already used by the 180 modes: 360 Stereo -> Stereo 360 Top to Bottom (new) -> Stereo 360 Left to Right Translations are updated for de and en-rGB only; the remaining locales fall back to English until they are handled by the l10n process. The string key is kept so existing translations are not orphaned. Verified on a Pico Neo 3 (OpenXR) with an equirect test video whose left half is red and right half blue: the left eye shows red, the right blue.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With the move from OculusVR to OpenXR several VR video formats stopped working and were fixed one format at a time — 3D side-by-side in 6f5793b, Stereo 180 Left to Right in 01cca10 (Fixes #562). The remaining equirect projections were never revisited and still carry both of the defects #562 described. Three independent commits, each builds on its own.
Both eyes get the same half of the frame — #562: "flat (no depth) with same image in each eye". VRLayer defaults useSameLayerForBothEyes to true, so GetNumXRLayers() submits a single equirect layer with XR_EYE_VISIBILITY_BOTH and applies only the left eye's UV transform. create180LRProjectionLayer() got the fix in 01cca10; create360StereoProjectionLayer() and create180TBProjectionLayer() did not. The default is now documented where it is declared, since nothing marked that call as load-bearing.
The 180 degree hemisphere is not centred — #562: "stretched to a dome almost to the extent when there should be black there". A horizontal UV scale of 2 maps the texture onto half the sphere, so without the matching -0.5 bias that half sits 90 degrees off to the side and looking forward shows the edge of the image. Also fixed for left-to-right only in 01cca10; create180ProjectionLayer() and create180TBProjectionLayer() were left out.
Adds VIDEO_PROJECTION_360_STEREO_LEFT_RIGHT. Full-sphere stereo existed only as over/under. Adds mesh and compositor-layer implementations, a menu entry and mozVideoProjection=360lr, plus 360tb as an alias for 360s. Neither the "360 Stereo" label nor its icon said that it means over/under, so both 360 modes now follow the naming and divider-bar icon conventions of the 180 modes: 360 Stereo → Stereo 360 Top to Bottom, new → Stereo 360 Left to Right. The string key is kept so existing translations are not orphaned; de and en-rGB are updated. Happy to use a new key, or hand the icons to someone with a better eye, if you prefer.
Tested on a Pico Neo 3 (OpenXR, Gecko) with generated equirect videos where one half is red and the other blue. Before, all three stereo modes showed red in both eyes; now the left eye shows red and the right blue, and 180 top/bottom is centred. Can post the ffmpeg and adb commands if useful.