Merged Mads Buvik Sandvei requested to merge madsbuvi/openmw:Stereo-MR into master

Introduces changes to stereo rendering, by introducing explicit support for stereo rendering in OpenMW. This is mostly imported from the VR MR to break it into somewhat smaller changes. This deprecates !273 (closed) as a cleaner implementation is part of these changes.

Stereo rendering is primarily managed transparently by the stereo manager, as well as the RTT class which manages per-view mapping. However when GL_OVR_multiview is enabled, co-operation is required by shaders. This documented in the multiview_vertex.glsl and multiview_fragment.glsl files.

The multiview feature is only available if a build of OSG with support for this is used to build OpenMW. I've addedone build that uses my build of OSG with multiview support to the CI, Windows_Ninja_Engine_Release_MultiView

To support VR i had to implement a system for managing color formats, similar to how depth format was managed. This is because VR systems vary greatly in what color and depth formats they support, so simply defaulting to GL_RGB was no longer possible. Since the stereo manager also has to manage its own framebuffers, i refactored depth/color format selection so that the pre-processor and the stereo-manager could both get the relevant information from the same place. Color/depth format, as well as ReverseZ, is now initialized by graphics operations while creating the window.

Known Issues:

  • When multiview is enabled, the local map receives a black border between segments
  • When multiview is enabled, RTT features like the local map and character preview needs to render with multiview despite having no use for this, because they renders with the same shaders as the scene does.
  • Some drivers break multiview when using display lists
  • Save-game screenshots may have excessive trimming since views may have awkward aspect ratios.
Edited by Mads Buvik Sandvei