Forum Discussion

2EyeGuy's avatar
2EyeGuy
Adventurer
6 years ago

Washed out (double gamma correction) on OpenGL

No matter which swapchain format I specify, my OpenGL application always renders washed out. That implies that OpenGL always thinks it is rendering to a linear render target, while OpenXR always thinks I am submitting an sRGB render target. Changing the swapchain format that I ask OpenXR to create between sRGB and linear makes no difference, and neither does glEnable(GL_FRAMEBUFFER_SRGB).

4 Replies

  • Thanks for reporting, I've filed a task.
  • This also happens with the Oculus SDK natively (but only in OpenGL), and the Oculus SDK samples take into account this weird behaviour and manually apply a gamma of 2.2 in the pixel shader (even though the Oculus SDK documentation says it is incorrect to do that). Oculus can get away with that incorrect behaviour in their own API, but you can't do that in OpenXR because all the OpenXR runtimes have to behave the same, whether it is Oculus or SteamVR or whatever.
    • bingzhou.2023's avatar
      bingzhou.2023
      Explorer

      Both RGB and sRGB app will show brighter images on the screen. but if you use GL(glDisable(GL_FRAMEBUFFER_SRGB_EXT))  for sRGB app, it will be correct on the screen.

      As for RGB app, I found nothing helpful except do gamma correction manually in app side.

    • bingzhou.2023's avatar
      bingzhou.2023
      Explorer

      In their sample code like xrPassthroughGl.app, the descripted that:

      // This app was originally written with the presumption that
       // its swapchains and compositor front buffer were RGB.
       // In order to have the colors the same now that its compositing
       // to an sRGB front buffer, we have to write to an sRGB swapchain
      // but with the linear->sRGB conversion disabled on write.
         GL(glDisable(GL_FRAMEBUFFER_SRGB_EXT));

      Does this mean that RGB swapchain is not supported currently, because we have to write to an sRGB swapchain.