cancel
Showing results for 
Search instead for 
Did you mean: 

Washed out (double gamma correction) on OpenGL

2EyeGuy
Adventurer
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 4

eah
Protege
Thanks for reporting, I've filed a task.

2EyeGuy
Adventurer
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.

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.

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.